Welcome Guest, Not a member yet? Register   Sign In
Performance: Routing in routes.php vs. Apache mod_rewrite
#1

[eluser]Coomer[/eluser]
Has anyone ever done in-depth investigation into speed differences between routing using Apache's mod_rewrite and using CodeIgniter's routes.php file?

I'm working to make my pages execute extremely fast, and every little bit I can get counts (Even if it's not as easy to add new routes, which is a very uncommon task for me ;-)).

My guess is that using Apache alone and disabling routes in CodeIgniter will yield faster performance (especially since I enable mod_rewrite anyway to remove the index.php from my URLs), but I was curious as to if anyone had any definitive answers here. I searched but didn't find a whole lot about routing performance.
#2

[eluser]elvix[/eluser]
i'm not sure what you're asking is even possible. CI's index.php is the only actual public file that exists.

i'd suggest that perhaps you're looking for a solution in advance of an actual problem, and you should probably just proceed and built the site you want, irrespective of any potential performance concerns.
#3

[eluser]louis w[/eluser]
I would agree, if you are looking for the most optimal performance, moving your rewrites into mod_rewrite would be "faster" then doing it through CI. How much faster, I have no idea. Not sure if it would even be noticeable. For an enterprise level site, it might be a good idea thou.

I too would be interested if anyone did some benchmarking for this.
#4

[eluser]dawnerd[/eluser]
[quote author="elvix" date="1237841980"]i'm not sure what you're asking is even possible. CI's index.php is the only actual public file that exists.

i'd suggest that perhaps you're looking for a solution in advance of an actual problem, and you should probably just proceed and built the site you want, irrespective of any potential performance concerns.[/quote]

I have to disagree there.

You should always have performance in mind when building a site. Saying it woke be a problem just because your site is small for the moment can have major problems down the road. What would happen if your sir started to grow at a very rapid rate? Suddenly you get problems you never thought you would have.

I think it's better to address the performance issues the best you can right away rather than putting it off.
#5

[eluser]Mirage[/eluser]
I'd have to agree with Louis in that you'd probably have to have a ton of rewrites before it becomes noticeable. It would seem that the PHP version is going to be a bit slower - but then again - the router class will load either way and will executed either way. The only difference would be that it'd have less 'defined' routes to slog through.
#6

[eluser]CroNiX[/eluser]
mod rewrite will always be faster because it is being executed before it even gets to CI or any other php/html.
#7

[eluser]Mirage[/eluser]
That helps with URIs that should redirect elsewhere or otherwise preprocessed. But that's somewhat irrelevant for URI's that will be processed post index.php anyway. The router class is responsible for mapping controller and action. It will include and evaluate routes.php regardless. A handful of route-mappings to parse through is probably not measurable in a meaningful way unless you have a boatload (100's) of routes - which - you really shouldn't have anyway.




Theme © iAndrew 2016 - Forum software by © MyBB