From: chopraanmol1@... Date: 2018-08-19T16:25:35+00:00 Subject: [ruby-core:88555] [Ruby trunk Feature#15010] Reduce allocation for rest parameters Issue #15010 has been reported by chopraanmol1 (Anmol Chopra). ---------------------------------------- Feature #15010: Reduce allocation for rest parameters https://bugs.ruby-lang.org/issues/15010 * Author: chopraanmol1 (Anmol Chopra) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- Currently multiple arrays are allocated while making a call to method with rest parameter. E.g. ~~~ def rest_method(*args) #-> This will create 2 arrays end def post_method(*args,last) #-> This will create 3 arrays end ~~~ Applying following set of changes will reduce creation of array to 1 https://github.com/ruby/ruby/pull/1935 Benchmark Result: trunk ~~~ user system total real benchmark_method 0.408000 0.000000 0.408000 ( 0.405603) rest_method 0.992000 0.000000 0.992000 ( 0.992706) lead_method 1.000000 0.000000 1.000000 ( 0.999311) post_method 2.464000 0.000000 2.464000 ( 2.464712) lead_post_method 1.800000 0.000000 1.800000 ( 1.800882) ~~~ modified ~~~ user system total real benchmark_method 0.400000 0.000000 0.400000 ( 0.401134) rest_method 0.740000 0.000000 0.740000 ( 0.741038) lead_method 0.748000 0.000000 0.748000 ( 0.746265) post_method 1.992000 0.000000 1.992000 ( 1.992200) lead_post_method 1.632000 0.000000 1.632000 ( 1.631994) ~~~ ---Files-------------------------------- bench_method_arg.rb (774 Bytes) improve_rest_parameters_setup.patch (1.76 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: