- 29 8月, 2018 1 次提交
-
-
由 schneems 提交于
Here’s the micro benchmark: ```ruby module ActiveSupport module NewTryable #:nodoc: def try(*a, &b) return unless a.empty? || respond_to?(a.first) return public_send(*a, &b) unless a.empty? return nil unless block_given? return instance_eval(&b) if b.arity == 0 yield self end def try!(*a, &b) return public_send(*a, &b) if !a.empty? return nil unless block_given? return instance_eval(&b) if b.arity == 0 yield self end end end module ActiveSupport module OldTryable #:nodoc: def try(*a, &b) try!(*a, &b) if a.empty? || respond_to?(a.first) end def try!(*a, &b) if a.empty? && block_given? if b.arity == 0 instance_eval(&b) else yield self end else public_send(*a, &b) end end end end class FooNew include ActiveSupport::NewTryable def foo end end class FooOld include ActiveSupport::OldTryable def foo end end foo_new = FooNew.new foo_old = FooOld.new require 'benchmark/ips' Benchmark.ips do |x| x.report("old") { foo_old.try(:foo) } x.report("new") { foo_new.try(:foo) } x.compare! end # Warming up -------------------------------------- # old 144.178k i/100ms # new 172.371k i/100ms # Calculating ------------------------------------- # old 2.181M (± 8.0%) i/s - 10.813M in 5.001419s # new 2.889M (± 7.7%) i/s - 14.479M in 5.051760s # Comparison: # new: 2888691.7 i/s # old: 2180740.7 i/s - 1.32x slower ``` Also reduces memory. On https://www.codetriage.com i’m seeing 1.5% fewer object allocations per request (in object count). Before: Total allocated: 1014475 bytes (8525 objects) After: Total allocated: 1015499 bytes (8389 objects)
-
- 22 8月, 2018 13 次提交
-
-
由 Ryuta Kamizono 提交于
This was introduced at 24f6bf0d.
-
由 Matthew Draper 提交于
Add database configuration to disable advisory locks.
-
由 Matthew Draper 提交于
Use public_send in value_for_collection
-
由 Eileen M. Uchitelle 提交于
[WIP] Action cable testing
-
-
由 utilum 提交于
This patch corrects a duplicate method name introduced in #33635. Also fixes typo in method names.
-
由 Rafael França 提交于
[ci skip] Add ImageMagick to Brewfile
-
由 Mr. Outis 提交于
In order to run ActiveStorage's tests successfully, you need imagemagick
-
由 yuuji.yaginuma 提交于
It seems to need an escape for the showing `ENV`. https://api.rubyonrails.org/classes/AbstractController/Caching/Fragments.html#method-i-combined_fragment_cache_key
-
由 George Claghorn 提交于
-
由 George Claghorn 提交于
[ci skip] Add ImageMagick to ActiveStorage dependencies
-
由 Mr. Outis 提交于
In order to run ActiveStorage's tests successfully, you need imagemagick.
-
由 Rafael França 提交于
Add usage of procs without arguments to callbacks guide
-
- 21 8月, 2018 2 次提交
-
-
由 Richard Schneeman 提交于
Make `rake routes` deprecate before deleting
-
由 Jeremy Daer 提交于
Improve Active Job test helpers
-
- 20 8月, 2018 24 次提交
-
-
由 Ryuta Kamizono 提交于
The `Relation::Merger` has a problem that order values would be merged as nested array. That was caused an issue #33664 since if array value is passed to `order` and first element in the array includes `?`, the array is regarded as a prepared statement and bind variables. https://api.rubyonrails.org/classes/ActiveRecord/Sanitization/ClassMethods.html#method-i-sanitize_sql_for_order Just merging that as splat args like other values would fix the issue. Fixes #33664.
-
由 Ryuta Kamizono 提交于
Fix `rails routes -c` for controller name consists of multiple word.
-
由 Ryuta Kamizono 提交于
Improve tests for ActiveRecord::ConnectionAdapters::ConnectionPool co…
-
由 Yoshiyuki Kinjo 提交于
-
由 bogdanvlviv 提交于
-
由 bogdanvlviv 提交于
-
由 bogdanvlviv 提交于
Example: ``` def test_assert_performed_with MyJob.perform_later(1,2,3) perform_enqueued_jobs assert_performed_with(job: MyJob, args: [1,2,3], queue: 'high') end ``` Follow up #33626.
-
由 bogdanvlviv 提交于
Execution of `assert_performed_jobs`, and `assert_no_performed_jobs` without a block should respect passed `:except`, `:only`, and `:queue` options.
-
由 bogdanvlviv 提交于
Note that it removes changelog entry of #33265 since the entry in this commits includes that too.
-
由 bogdanvlviv 提交于
If the `:queue` option is specified, then only the job(s) enqueued to a specific queue will not be performed. Example: ``` def test_assert_no_performed_jobs_with_queue_option assert_no_performed_jobs queue: :some_queue do HelloJob.set(queue: :other_queue).perform_later("jeremy") end end ```
-
由 bogdanvlviv 提交于
If the `:queue` option is specified, then only the job(s) enqueued to a specific queue will be performed. Example: ``` def test_assert_performed_jobs_with_queue_option assert_performed_jobs 1, queue: :some_queue do HelloJob.set(queue: :some_queue).perform_later("jeremy") HelloJob.set(queue: :other_queue).perform_later("bogdan") end end ```
-
由 bogdanvlviv 提交于
Set ```` queue_adapter.perform_enqueued_jobs = true queue_adapter.perform_enqueued_at_jobs = true queue_adapter.filter = only queue_adapter.reject = except queue_adapter.queue = queue ``` if block given. Execution of `flush_enqueued_jobs` doesn't require that.
-
由 Guo Xiang Tan 提交于
-
由 Fabian Schwahn 提交于
-
由 Ryuta Kamizono 提交于
Add missing documentation option to number_to_currency [ci skip]
-
由 yuuji.yaginuma 提交于
`rake routes` was a public task. Therefore, I think that we should deprecate it before deleting it. Related to #32121.
-
由 Vladimir Dementyev 提交于
-
由 Vladimir Dementyev 提交于
-
由 Richard Schneeman 提交于
Update guide to mention code linters available
-
由 bogdanvlviv 提交于
If the `:queue` option is specified, then only the job(s) enqueued to a specific queue will be performed. Example: ``` def test_perform_enqueued_jobs_with_queue perform_enqueued_jobs queue: :some_queue do MyJob.set(queue: :some_queue).perform_later(1, 2, 3) # will be performed HelloJob.set(queue: :other_queue).perform_later(1, 2, 3) # will not be performed end assert_performed_jobs 1 end ``` Follow up #33265 [bogdanvlviv & Jeremy Daer]
-
由 Kasper Timm Hansen 提交于
Commands generally prefer say to puts.
-
由 Ryuta Kamizono 提交于
Improve test case to test enum correctly
-
由 Kasper Timm Hansen 提交于
Move the initializers rake task to Rails::Command
-
由 Kasper Timm Hansen 提交于
activestorage: yarn build
-