From: "jeremyevans0 (Jeremy Evans)" Date: 2022-10-22T22:10:36+00:00 Subject: [ruby-core:110482] [Ruby master Feature#19076] Improve performance Proc#parameters Issue #19076 has been updated by jeremyevans0 (Jeremy Evans). If I'm reading the benchmark results correctly, this is slower in the case that the keyword argument is not provided. Is that correct? If so, I don't think we should do this, because it is far more common to not provide a keyword argument when calling these methods. ---------------------------------------- Feature #19076: Improve performance Proc#parameters https://bugs.ruby-lang.org/issues/19076#change-99800 * Author: S_H_ (Shun Hiraoka) * Status: Open * Priority: Normal ---------------------------------------- Improve performance `Proc#parameters` method(write in Ruby) benchmark: ```yml prelude: | prc = proc{|x, y=42, *other|} lam = lambda{|x, y=42, *other|} benchmark: proc_no_kwarg: | prc.parameters proc_given_kwarg: | prc.parameters(lambda: false) lambda_no_kwarg: | prc.parameters lambda_given_kwarg: | prc.parameters(lambda: false) loop_count: 20000000 ``` result: ```bash sh@DESKTOP-L0NI312:~/rubydev/build$ make benchmark/benchmark.yml -e BENCH_RUBY=../install/bin/ruby -e COMPARE_RUBY=~/.rbenv/shims/ruby ../ruby/revision.h unchanged compare-ruby: ruby 3.2.0dev (2022-10-22T10:34:00Z master 8dfe3bdf48) [x86_64-linux] built-ruby: ruby 3.2.0dev (2022-10-22T10:34:00Z improve_prom_param.. 8dfe3bdf48) [x86_64-linux] # Iteration per second (i/s) | |compare-ruby|built-ruby| |:-------------------|-----------:|---------:| |proc_no_kwarg | 4.559M| 3.944M| | | 1.16x| -| |proc_given_kwarg | 2.885M| 3.652M| | | -| 1.27x| |lambda_no_kwarg | 4.732M| 3.800M| | | 1.25x| -| |lambda_given_kwarg | 2.858M| 3.603M| | | -| 1.26x| ``` COMPARE_RUBY is `ruby 3.2.0dev (2022-10-22T10:34:00Z master 8dfe3bdf48) [x86_64-linux]`. BENCH_RUBY is ahead of `ruby 3.2.0dev (2022-10-22T10:34:00Z master 8dfe3bdf48) [x86_64-linux]`. pull request: https://github.com/ruby/ruby/pull/6617 -- https://bugs.ruby-lang.org/ Unsubscribe: