Project

General

Profile

Feature #14994

Enumerator::Lazy#uniq & Enumerator::Lazy#grep_v should use proc chaining

Added by chopraanmol1 (Anmol Chopra) over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:88492]

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

bench_enum_lazy_proc_chain.rb (781 Bytes) bench_enum_lazy_proc_chain.rb chopraanmol1 (Anmol Chopra), 08/15/2018 06:35 AM

Associated revisions

Revision 7d6a26f2
Added by nobu (Nobuyoshi Nakada) over 1 year ago

Adding Enumerator::Lazy#uniq and Enumerator::Lazy#grep_v to proc chaining

[Feature #14994]

[Fix GH-1930]

From: Anmol Chopra chopraanmol1@gmail.com

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 64385
Added by nobu (Nobuyoshi Nakada) over 1 year ago

Adding Enumerator::Lazy#uniq and Enumerator::Lazy#grep_v to proc chaining

[Feature #14994]

[Fix GH-1930]

From: Anmol Chopra chopraanmol1@gmail.com

Revision 64385
Added by nobu (Nobuyoshi Nakada) over 1 year ago

Adding Enumerator::Lazy#uniq and Enumerator::Lazy#grep_v to proc chaining

[Feature #14994]

[Fix GH-1930]

From: Anmol Chopra chopraanmol1@gmail.com

History

#1

Updated by nobu (Nobuyoshi Nakada) over 1 year ago

  • Status changed from Open to Closed

Applied in changeset trunk|r64385.


Adding Enumerator::Lazy#uniq and Enumerator::Lazy#grep_v to proc chaining

[Feature #14994]

[Fix GH-1930]

From: Anmol Chopra chopraanmol1@gmail.com

Also available in: Atom PDF