Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | pass the parsed path from mapper to the Strexp | Aaron Patterson | 2014-05-29 | 1 | -3/+6 |
| | |||||
* | add an alternate constructor to Strexp that takes a string | Aaron Patterson | 2014-05-29 | 1 | -1/+1 |
| | |||||
* | PARAMETERS_KEY is only used in the request, so move the constant there | Aaron Patterson | 2014-05-27 | 1 | -2/+0 |
| | |||||
* | move path_parameter encoding check to the request object | Aaron Patterson | 2014-05-27 | 1 | -10/+1 |
| | |||||
* | dispatcher doesn't need `call` anymore | Aaron Patterson | 2014-05-27 | 1 | -4/+0 |
| | |||||
* | give all endpoints a superclass | Aaron Patterson | 2014-05-27 | 1 | -3/+10 |
| | |||||
* | pass a request to `matches?` so we can avoid creating excess requests | Aaron Patterson | 2014-05-25 | 1 | -1/+1 |
| | |||||
* | push is_a?(Dispatcher) check in to one place | Aaron Patterson | 2014-05-24 | 1 | -5/+3 |
| | |||||
* | Always construct route objects with Constraint objects | Aaron Patterson | 2014-05-24 | 1 | -1/+1 |
| | |||||
* | unwrap the constraints object on initialization, eliminate loops | Aaron Patterson | 2014-05-24 | 1 | -1/+1 |
| | | | | | | | Unwrap Constraints objects. I don't actually think it's possible to pass a Constraints object to this constructor, but there were multiple places that kept testing children of this object. I *think* they were just being defensive, but I have no idea. | ||||
* | glob_param is never used, so rm | Aaron Patterson | 2014-05-23 | 1 | -8/+2 |
| | | | | | | this also changes the constructor. We don't need to pass more options than "defaults" (whatever defaults are, ugh. probably another hash of stupid stuff). | ||||
* | decouple the router object from the request class | Aaron Patterson | 2014-05-23 | 1 | -2/+1 |
| | |||||
* | pass the correct custom request to the recognize method | Aaron Patterson | 2014-05-23 | 1 | -1/+1 |
| | |||||
* | pull request allocation up one frame | Aaron Patterson | 2014-05-23 | 1 | -1/+3 |
| | |||||
* | stop using PARAMETERS_KEY, and use the accessor on the request object | Aaron Patterson | 2014-05-22 | 1 | -1/+0 |
| | | | | this decouples our code from the env hash a bit. | ||||
* | use symbol keys for path_parameters | Aaron Patterson | 2014-05-22 | 1 | -2/+2 |
| | |||||
* | middle variable is never used, so rm | Aaron Patterson | 2014-05-21 | 1 | -1/+1 |
| | |||||
* | remove dead code. @klass isn't used anymore | Aaron Patterson | 2014-05-21 | 1 | -1/+0 |
| | |||||
* | reuse path formatter from the non-optimized path. | Aaron Patterson | 2014-05-21 | 1 | -6/+1 |
| | | | | | The optimized and non-optimized path share more code now without significant performance degretation | ||||
* | reduce object allocations | Aaron Patterson | 2014-05-21 | 1 | -2/+4 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example: x = [1,2,3,4] y = [3,2,1] def test x, y hash = {} x.zip(y) { |k,v| hash[k] = v } hash end def test2 x, y Hash[x.zip(y)] end def test3 x, y x.zip(y).each_with_object({}) { |(k,v),hash| hash[k] = v } end def stat num start = GC.stat(:total_allocated_object) num.times { yield } total_obj_count = GC.stat(:total_allocated_object) - start puts "#{total_obj_count / num} allocations per call" end stat(100) { test(x,y) } stat(100) { test2(x,y) } stat(100) { test3(x,y) } __END__ 2 allocations per call 7 allocations per call 8 allocations per call | ||||
* | we don't use this parameter for anything, so rm | Aaron Patterson | 2014-05-20 | 1 | -1/+1 |
| | |||||
* | fewer hash allocations when calling url_for | Aaron Patterson | 2014-05-20 | 1 | -9/+12 |
| | |||||
* | fix variable names, only pass hashes to the positional args method | Aaron Patterson | 2014-05-20 | 1 | -8/+10 |
| | |||||
* | Only path requirements are relevant to optimized urls | Andrew White | 2014-05-15 | 1 | -1/+1 |
| | | | | | The bit of URL generation that is optimized is the generation of the path so things like :host, :port, etc. are irrelevant. | ||||
* | Add missing requires for require 'action_dispatch/routing' | Andrew White | 2014-05-15 | 1 | -0/+2 |
| | |||||
* | _recall should be set to a hash or not set | Aaron Patterson | 2014-05-13 | 1 | -2/+2 |
| | | | | Then we can avoid nil checks | ||||
* | we never call url_for with a block, so rm | Aaron Patterson | 2014-05-13 | 1 | -1/+0 |
| | |||||
* | drop || test for cases that do not need it | Aaron Patterson | 2014-05-13 | 1 | -3/+3 |
| | |||||
* | no need to check for presence, script names can be blank | Aaron Patterson | 2014-05-13 | 1 | -2/+2 |
| | |||||
* | this method should always have a parameter passed to it, so remove the default | Aaron Patterson | 2014-05-13 | 1 | -1/+1 |
| | |||||
* | options should always be passed to url_for | Aaron Patterson | 2014-05-13 | 1 | -2/+2 |
| | |||||
* | calls with :host should still use the optimized path | Aaron Patterson | 2014-05-13 | 1 | -2/+2 |
| | |||||
* | use fewer method calls to determine the url_for options | Aaron Patterson | 2014-05-13 | 1 | -5/+4 |
| | |||||
* | just merge instead of dup and merge | Aaron Patterson | 2014-05-13 | 1 | -2/+1 |
| | |||||
* | the :only_path option is applied by the time the helper is called | Aaron Patterson | 2014-05-13 | 1 | -4/+1 |
| | |||||
* | options already have symbolized keys, so we can avoid this call | Aaron Patterson | 2014-05-13 | 1 | -1/+1 |
| | |||||
* | Get rid of unused method | Carlos Antonio da Silva | 2014-05-13 | 1 | -11/+0 |
| | | | | It's usage has been removed in 325c9d5e5235db4b5210d9db6c863835d1ac7eed. | ||||
* | avoid array allocation when extracting usernames and passwords | Aaron Patterson | 2014-05-12 | 1 | -1/+7 |
| | |||||
* | Revert "reduce conditionals in url_for" | Aaron Patterson | 2014-05-12 | 1 | -6/+3 |
| | | | | This reverts commit 9df60693d77813b362fb528fc62381ac8f1eec12. | ||||
* | reduce conditionals in url_for | Aaron Patterson | 2014-05-12 | 1 | -3/+6 |
| | |||||
* | make the module version quack the same as the instance | Aaron Patterson | 2014-05-12 | 1 | -3/+10 |
| | | | | this way we can stop checking respond_to on every call. | ||||
* | Hash#except is expensive and this is a hotspot, so use a dup + delete | Aaron Patterson | 2014-05-12 | 1 | -1/+2 |
| | |||||
* | Make URL escaping more consistent | Andrew White | 2014-04-20 | 1 | -2/+2 |
| | | | | | | | | | | | | | | | | | | | | | | 1. Escape '%' characters in URLs - only unescaped data should be passed to URL helpers 2. Add an `escape_segment` helper to `Router::Utils` that escapes '/' characters 3. Use `escape_segment` rather than `escape_fragment` in optimized URL generation 4. Use `escape_segment` rather than `escape_path` in URL generation For point 4 there are two exceptions. Firstly, when a route uses wildcard segments (e.g. *foo) then we use `escape_path` as the value may contain '/' characters. This means that wildcard routes can't be optimized. Secondly, if a `:controller` segment is used in the path then this uses `escape_path` as the controller may be namespaced. Fixes #14629, #14636 and #14070. | ||||
* | Unique the segment keys array for non-optimized url helpers | Andrew White | 2014-01-05 | 1 | -1/+1 |
| | | | | | | | | | | In Rails 3.2 you only needed pass an argument for dynamic segment once so unique the segment keys array to match the number of args. Since the number of args is less than required parts the non-optimized code path is selected. This means to benefit from optimized url generation the arg needs to be specified as many times as it appears in the path. Fixes #12808 | ||||
* | Show full route constraints in error message | Andrew White | 2014-01-05 | 1 | -2/+3 |
| | | | | | | | | When an optimized helper fails to generate, show the full route constraints in the error message. Previously it would only show the contraints that were required as part of the path. Fixes #13592 | ||||
* | Simplify arg parameterization | Andrew White | 2014-01-05 | 1 | -6/+1 |
| | |||||
* | Use a custom route vistor for optimized route generation | Andrew White | 2014-01-05 | 1 | -27/+25 |
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using a Regexp to replace dynamic segments in a path string is fraught with difficulty and can lead to odd edge cases like #13349. Since we already have a parsed representation of the path it makes sense to use that to generate an array of segments that can be used to build an optimized route's path quickly. Tests on a simple route (e.g. /posts/:id) show a speedup of 35%: https://gist.github.com/pixeltrix/8261932 Calculating ------------------------------------- Current Helper: 5274 i/100ms New Helper: 8050 i/100ms ------------------------------------------------- Current Helper: 79263.6 (±3.7%) i/s - 395550 in 4.997252s New Helper: 153464.5 (±4.9%) i/s - 772800 in 5.047834s Tests on a more complex route show even an greater performance boost: https://gist.github.com/pixeltrix/8261957 Calculating ------------------------------------- Current Helper: 2367 i/100ms New Helper: 5382 i/100ms ------------------------------------------------- Current Helper: 29506.0 (±3.2%) i/s - 149121 in 5.059294s New Helper: 78815.5 (±4.1%) i/s - 398268 in 5.062161s It also has the added benefit of fixing the edge cases described above. Fixes #13349 | ||||
* | Spelling and Grammar checks | Akshay Vishnoi | 2013-12-12 | 1 | -1/+1 |
| | |||||
* | Merge pull request #12216 from suginoy/a-an | Rafael Mendonça França | 2013-09-13 | 1 | -1/+1 |
|\ | | | | | Fix typos: the indefinite articles(a -> an). | ||||
| * | Fix typos: the indefinite articles(a -> an) | SUGINO Yasuhiro | 2013-09-13 | 1 | -1/+1 |
| | |