Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Add performance tests for flatMap operation in OperationContainer #740

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use Try instead of Success
Timur Abishev committed Jul 6, 2017
commit a2b653af98c11fabb3aca0823f9a89ad753082ce
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ import org.openjdk.jmh.infra.Blackhole
*
* Benchmark Mode Cnt Score Error Units
* ComposedFlatMapPerformance.measureDirect avgt 10 239.003 ± 19.990 ms/op
* ComposedFlatMapPerformance.measureDirectOperationContainer avgt 10 366.307 ± 109.717 ms/op
* ComposedFlatMapPerformance.measureDirectOperationContainer avgt 10 295.847 ± 14.774 ms/op
* ComposedFlatMapPerformance.measureOperationContainerComposeThroughOperation avgt 10 2733.537 ± 63.415 ms/op
* ComposedFlatMapPerformance.measureOperationContainerDirectCompose avgt 10 1084.457 ± 22.968 ms/op
*/
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ import org.openjdk.jmh.infra.Blackhole
*
* Benchmark Mode Cnt Score Error Units
* ComposedFlatMapWithTimePerformance.measureDirectComplex avgt 10 340.341 ± 4.343 ms/op
* ComposedFlatMapWithTimePerformance.measureDirectOperationContainer avgt 10 396.599 ± 9.106 ms/op
* ComposedFlatMapWithTimePerformance.measureDirectOperationContainer avgt 10 386.593 ± 6.474 ms/op
* ComposedFlatMapWithTimePerformance.measureDirectSimple avgt 10 279.628 ± 6.175 ms/op
* ComposedFlatMapWithTimePerformance.measureOperationContainerComposeThroughOperation avgt 10 2978.141 ± 75.213 ms/op
* ComposedFlatMapWithTimePerformance.measureOperationContainerDirectCompose avgt 10 1198.601 ± 54.871 ms/op
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ import org.openjdk.jmh.infra.Blackhole
*
* Benchmark Mode Cnt Score Error Units
* IdentityFlatMapPerformance.measureDirect avgt 10 42.184 ± 3.518 ms/op
* IdentityFlatMapPerformance.measureDirectOperationContainer avgt 10 87.605 ± 3.843 ms/op
* IdentityFlatMapPerformance.measureDirectOperationContainer avgt 10 101.944 ± 3.956 ms/op
* IdentityFlatMapPerformance.measureOperationContainer avgt 10 817.659 ± 36.591 ms/op
*/
@State(Scope.Thread)
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.twitter.summingbird.online.executor
import chain.Chain
import scala.util.{Success, Try}
import scala.util.Try

class SimpleFlatMap[I, O, S](f: I => TraversableOnce[O]) extends OperationContainer[I, O, S] {
override def executeTick: TraversableOnce[(Chain[S], Try[TraversableOnce[O]])] =
None

override def execute(state: S,data: I): TraversableOnce[(Chain[S], Try[TraversableOnce[O]])] =
Some((Chain.single(state), Success(f(data))))
Some((Chain.single(state), Try(f(data))))
}