-
Notifications
You must be signed in to change notification settings - Fork 72
Add lazyZip operation (formerly zipWith) #223
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,6 +135,21 @@ class HashSetBenchmark { | |
} | ||
} | ||
|
||
@Benchmark | ||
def transform_zip(bh: Blackhole): Unit = bh.consume(xs.zip(xs)) | ||
|
||
@Benchmark | ||
def transform_zipMapTupled(bh: Blackhole): Unit = { | ||
val f = (a: Long, b: Long) => (a, b) | ||
bh.consume(xs.zip(xs).map(f.tupled)) | ||
} | ||
|
||
@Benchmark | ||
def transform_zipWithIndex(bh: Blackhole): Unit = bh.consume(xs.zipWithIndex) | ||
|
||
@Benchmark | ||
def transform_lazyZip(bh: Blackhole): Unit = bh.consume(xs.lazyZip(xs).map((_, _))) | ||
|
||
@Benchmark | ||
def transform_unzip(bh: Blackhole): Unit = bh.consume(zipped.unzip) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there any recommendation for when (not) to add new benchmarks to the project? These are going to add several hours to the running time There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No recommendation so far. New benchmarks are always welcomed for now. In my case anyway I only run a subset of the benchmarks when I run them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, what I do sometimes is that I group related benchmarks together so that it’s simpler to run just the benchmarks that I’m interested in: https://github.com/scala/collection-strawman/blob/master/benchmarks/time/src/main/scala/strawman/collection/GroupMapBenchmarks.scala |
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add more benchmarks to compare
xs.lazyZip(ys).map(f)
withxs.zip(ys).map(f.tupled)
?