Comments (7)
Interesting proposal, could you explain why this (especially dropping caching) would be better?
from core.
Both versions work at same speed:
current - spends time on deserialization, problems with serialization closures
my - spends time on generation of regexp (it need not for all routes, in most cases, for 2-5 objects), removes external dependence (Kohana_Core).
from core.
Do you have profiling to support that?
It must depend on pattern of site usage and order of route definitions. If most requests are to the last defined route, then all routes will have to be compiled every request.
We use a reasonable number of routes in our project and there's a very noticeable boost from using Route::cache
so would want to be sure of the impact before dropping it.
Accept the point re serialising closures. Dependency on Kohana_Core could be removed by injection if necessary.
Maybe the solution is to add lazy load but keep Route::cache so people can choose which works best for them?
from core.
Do you have profiling to support that?
Ok, add tests tomorrow.
Maybe the solution is to add lazy load but keep Route::cache so people can choose which works best for them?
These versions are not compatible (
from core.
We use a reasonable number of routes in our project and there's a very noticeable boost from using Route::cache so would want to be sure of the impact before dropping it.
For example, we have 9 routes (50-60% requests) and default route (40-50% requests), then regexp compile not for all routes in 50-60% cases. Current code deserialize routes in 100% requests.
from core.
We use a reasonable number of routes in our project and there's a very noticeable boost from using Route::cache so would want to be sure of the impact before dropping it.
For example, we have 9 routes (50-60% requests) and default route (40-50% requests), then regexp compile not for all routes in 50-60% cases. Current code deserialize routes in 100% requests.
But do you have profiling showing overhead of deserialize compared to overhead of compiling? I've not noticed an issue with deserialize in production. They're relatively small objects.
Your example slightly simplifies when you say "regexp compile not for all routes in 50-60% of cases". There'll be a percentage that compile 8/9 routes, some do 7/9, some do 6/9 etc.
Say for ease you have 100 requests a minute and traffic like this:
Route | req/min | compiles/min |
---|---|---|
1 | 9 | 9 |
2 | 9 | 18 |
3 | 9 | 27 |
4 | 9 | 36 |
5 | 9 | 45 |
6 | 9 | 54 |
7 | 9 | 63 |
8 | 9 | 72 |
9 | 9 | 81 |
default | 46 | 460 |
total | 100 | 865 |
With Route::cache
you'd have 100 deserialize operations. With lazy load you have 865 compile operations. Is deserializing really more than 8 times slower than compiling?
Obviously like I said it depends on your traffic pattern and route definitions. Still though I think this isn't a change we should make on a hunch, you need to provide data showing the relative performance.
Maybe the solution is to add lazy load but keep Route::cache so people can choose which works best for them?
These versions are not compatible
Why? Surely if Route::cache forces all routes to compile then they can be cached, or am I missing something?
IMO unless you have profiling data we should close this. If you want to add lazy load that supports caching, then that would give people a useful choice eg if they want to use closures in filters.
from core.
Why? Surely if Route::cache forces all routes to compile then they can be cached, or am I missing something?
Some cached routes contain not compiled regexp - need cache only compiled routes or recache if routes added\compiled.
In order to avoid problems with serialization can add a parameter $cache to route - if we add closure to filters, then set $cache = false and before caching routes we check this parameter.
from core.
Related Issues (20)
- Use of mikey179/vfsStream for Log tests breaks module builds HOT 3
- 3.4.0 current status HOT 49
- Change detecting urls starting with //
- Improvements on website HOT 10
- 1 repo to rule them all HOT 12
- .git files in modules release for 3.3.5 HOT 4
- 4.0.0 release HOT 16
- Ubuntu packages HOT 9
- modules and composer - play together nicer HOT 2
- Should we remove 'action', 'controller', 'directory' from request params? HOT 4
- Implementation of external requests in Minion Task HOT 5
- [Security] Encrypt HOT 34
- Issues with PHP 7.0.6 and ORM HOT 3
- Use Route:url in Minion Task HOT 1
- ERROR: Kohana_Exception [ 0 ]: Directory APPPATH/cache must be writable HOT 8
- "content-length" -header calculation in Response
- Server Upgraded to PHP7 Error: __toString() must not throw an exception HOT 4
- Error en Core Handle
- Function Valid::date for timestamp HOT 1
- [Proposal] Make middlewares HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.