DASPRiD / Dash

Flexible PSR-7 compliant HTTP router
BSD 2-Clause "Simplified" License
29 stars 9 forks source link

Feature/segment caching #31

Closed DASPRiD closed 10 years ago

DASPRiD commented 10 years ago

I'd like to get some feedback on this before merging into master.

Usage: Within any of your application modules onBootstrap() methods, you can do:

$serviceLocator = $event->getApplication()->getServiceManager();
$parserManager = $serviceLocator->get('Dash\Router\Http\Parser\ParserManager');
$parserManager->setCache($serviceLocator->get('Your\Configured\Cache'));

Update: Okay, we can completely forget about this. I just ran a benchmark with the caching, and apparently Zend\Cache has such a bottleneck that it's not worth using it:

Without cache, 10,000 cycles:
0.78266501426697
With cache, 10,000 cycles:
3.2520899772644
coveralls commented 10 years ago

Coverage Status

Coverage decreased (-1.29%) when pulling cc8e13a617e061824d47525f0ba40b6c793a25f7 on feature/segment-caching into f88ce77f3a55bba597de238fc709f63f4d1c9e29 on master.

coveralls commented 10 years ago

Coverage Status

Coverage remained the same when pulling 7523e4f6daa715c91b34cd82aa24a10aab7f3dd6 on feature/segment-caching into f88ce77f3a55bba597de238fc709f63f4d1c9e29 on master.

coveralls commented 10 years ago

Coverage Status

Coverage remained the same when pulling c34b0627d894746f11a569783737515641741ef2 on feature/segment-caching into f88ce77f3a55bba597de238fc709f63f4d1c9e29 on master.

coveralls commented 10 years ago

Coverage Status

Coverage remained the same when pulling 67051eb3649926dc4855da3660fcf083f0882990 on feature/segment-caching into f88ce77f3a55bba597de238fc709f63f4d1c9e29 on master.

DASPRiD commented 10 years ago

Caching is pointless thanks to Zend\Cache, closing.

macnibblet commented 10 years ago

Uh, is Zend\Cache the problem or just caching in general ?

DASPRiD commented 10 years ago

@macnibblet Zend\Cache is pretty much the problem. It introduces so many function calls for getting an item, that it takes more time than parsing the pattern.