- 31 7月, 2015 4 次提交
-
-
由 schneems 提交于
It is slightly faster: ``` Calculating ------------------------------------- each; delete 35.166k i/100ms delete_if 36.416k i/100ms ------------------------------------------------- each; delete 478.026k (± 8.5%) i/s - 2.391M delete_if 485.123k (± 7.9%) i/s - 2.440M ```
-
由 schneems 提交于
We don't always need an array when generating a url with the formatter. We can be lazy about allocating the `missing_keys` array. This saves us: 35,606 bytes and 889 objects per request
-
由 schneems 提交于
THe only reason we were allocating an array is to get the "missing_keys" variable in scope of the error message generator. Guess what? Arrays kinda take up a lot of memory, so by replacing that with a nil, we save: 35,303 bytes and 886 objects per request
-
由 schneems 提交于
When `defaults[key]` in `generate` in the journey formatter is called, it often returns a `nil` when we call `to_s` on a nil, it allocates an empty string. We can skip this check when the default value is nil. This change buys us 35,431 bytes of memory and 887 fewer objects per request. Thanks to @matthewd for help with the readability
-
- 30 7月, 2015 2 次提交
-
-
由 schneems 提交于
Most routes have a `route.path.requirements[key]` of `/[-_.a-zA-Z0-9]+\/[-_.a-zA-Z0-9]+/` yet every time this method is called a new regex is generated on the fly with `/\A#{DEFAULT_INPUT}\Z/`. OBJECT ALLOCATIONS BLERG! This change uses a special module that implements `===` so it can be used in a case statement to pull out the default input. When this happens, we use a pre-generated regex. This change buys us 1,643,465 bytes of memory and 7,990 fewer objects per request.
-
由 schneems 提交于
Micro optimization: `reverse.drop_while` is slower than `reverse_each.drop_while`. This doesn't save any object allocations. Second, `keys_to_keep` is typically a very small array. The operation `parameterized_parts.keys - keys_to_keep` actually allocates two arrays. It is quicker (I benchmarked) to iterate over each and check inclusion in array manually. This change buys us 1774 fewer objects per request
-
- 08 4月, 2015 1 次提交
-
-
由 Yang Bo 提交于
it is avoid sort errot within different and mixed keys. used `sort_by` + `block` to list parameter by keys. keep minimum changes
-
- 04 1月, 2015 1 次提交
-
-
由 Rafael Mendonça França 提交于
-
- 23 11月, 2014 2 次提交
-
-
由 Godfrey Chan 提交于
If the route set is empty, or if none of the routes matches with a score > 0, there is no point showing the deprecation message because we are already be raising the `ActionController::UrlGenerationError` mentioned in the warning. In this case it is the expected behavior and the user wouldn't have to take any actions.
-
由 Godfrey Chan 提交于
The internal tests that (incorrectly) relied on this were already fixed in 938d130c. However, we cannot simply fix this bug because the guides prior to b7b9e920 recommended a workaround that relies on this buggy behavior. Reference #17453
-
- 21 10月, 2014 1 次提交
-
-
由 Accessd 提交于
-
- 18 7月, 2014 1 次提交
-
-
由 Aaron Patterson 提交于
"recall" is a terrible name. This variable contains the parameters that we got from the path (e.g. for "/posts/1" it has :controller => "posts", :id => "1"). Since it contains the parameters we got from the path, "path_parameters" is a better name. We always pass path_parameters to `generate`, so lets make it required.
-
- 23 5月, 2014 3 次提交
-
-
由 Viktar Basharymau 提交于
Nobody uses this private method, maybe it is a leftover from some old refactoring. Let's delete it.
-
由 Viktar Basharymau 提交于
Because it is used as a queue (FIFO), not as a stack (LIFO). * http://en.wikipedia.org/wiki/Stack_(abstract_data_type) * http://en.wikipedia.org/wiki/Queue_(data_structure)
-
由 Viktar Basharymau 提交于
Inspired by https://github.com/rails/rails/commit/931ee4186b877856b212b0085cd7bd7f6a4aea67 ```ruby 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 h = { 'x' => 'y' } stat(100) { h. each { |pair| pair } } stat(100) { h.to_a.each { |pair| pair } } __END__ 1 allocations per call 2 allocations per call ```
-
- 22 5月, 2014 2 次提交
-
-
由 Viktar Basharymau 提交于
The array is sorted in descending order, so there is no point in iterating further if we met a negative item - all the rest will be negative too.
-
由 Aaron Patterson 提交于
-
- 21 5月, 2014 1 次提交
-
-
由 Aaron Patterson 提交于
-
- 01 3月, 2014 1 次提交
-
-
由 Erik Michaels-Ober 提交于
-
- 05 1月, 2014 1 次提交
-
-
由 Andrew White 提交于
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
-
- 16 7月, 2013 1 次提交
-
-
由 Andrew White 提交于
When generating an unnamed url (i.e. using `url_for` with an options hash) we should skip anything other than standard Rails routes otherwise it will match the first mounted application or redirect and generate a url with query parameters rather than raising an error if the options hash doesn't match any defined routes. Fixes #8018
-
- 09 5月, 2013 1 次提交
-
-
由 Prathamesh Sonpatki 提交于
-
- 09 4月, 2013 1 次提交
-
-
由 Agis Anastasopoulos 提交于
It'd be a nice convention to mark the unused variables like this, now that Ruby 2 will issue no warnings for such vars being unused.
-
- 16 1月, 2013 1 次提交
-
-
由 Andrew White 提交于
Now that Journey has been integrated into ActionDispatch we can raise the exception ActionController::UrlGenerationError directly rather than raising the internal Journey::Router::RoutingError and then have ActionDispatch::Routing::RouteSet#generate re-raise the exception.
-
- 03 1月, 2013 1 次提交
-
-
由 Gosha Arinich 提交于
-
- 02 1月, 2013 1 次提交
-
-
由 Gosha Arinich 提交于
-
- 21 12月, 2012 1 次提交
-
-
由 Francesco Rodriguez 提交于
-
- 20 12月, 2012 2 次提交
-
-
由 Francesco Rodriguez 提交于
-
由 Andrew White 提交于
Move the Journey code underneath the ActionDispatch namespace so that we don't pollute the global namespace with names that may be used for models. Fixes rails/journey#49.
-