Actions
Feature #14994
closedEnumerator::Lazy#uniq & Enumerator::Lazy#grep_v should use proc chaining
Status:
Closed
Assignee:
-
Target version:
-
Description
Proc chaining for Enumerator::Lazy was introduced in https://bugs.ruby-lang.org/issues/6183
Proc chaining improved the performance on chained lazy enum for adapted method.
Current implementation of proc chaining can be easily used to methods which either transforming data or filter data(exception: expanding data e.g. flat_map, zip).
This issue suggest to adapt Enumerator::Lazy#uniq & Enumerator::Lazy#grep_v to utilize proc chaining.
Implementation:
https://github.com/ruby/ruby/pull/1930
Benchmark Result:
Trunk:
Chained grep_v 20% 0.228000 0.000000 0.228000 ( 0.227204)
Chained grep_v 50% 0.404000 0.000000 0.404000 ( 0.407150)
Chained grep_v 100% 0.684000 0.000000 0.684000 ( 0.685375)
Chained uniq 20% 0.280000 0.000000 0.280000 ( 0.282605)
Chained uniq 50% 0.468000 0.000000 0.468000 ( 0.468440)
Chained uniq 100% 0.784000 0.016000 0.800000 ( 0.802920)
Modified:
Chained grep_v 20% 0.212000 0.000000 0.212000 ( 0.212727)
Chained grep_v 50% 0.304000 0.000000 0.304000 ( 0.305567)
Chained grep_v 100% 0.444000 0.000000 0.444000 ( 0.442978)
Chained uniq 20% 0.240000 0.000000 0.240000 ( 0.239457)
Chained uniq 50% 0.340000 0.000000 0.340000 ( 0.341840)
Chained uniq 100% 0.512000 0.016000 0.528000 ( 0.530302)
Files
Actions
Like0
Like0