@@ -12,7 +12,7 @@ import scala.annotation.tailrec
12
12
@ OutputTimeUnit (TimeUnit .MILLISECONDS )
13
13
@ Warmup (iterations = 1000 )
14
14
@ Measurement (iterations = 10000 )
15
- @ Fork (value = 1 , jvmArgsAppend = Array (" -Xmx1G" , " -Xms1G" , " -ea " , " -server " , " -XX:+UseCompressedOops" , " -XX:+AlwaysPreTouch" , " -XX:+UseCondCardMark" ))
15
+ @ Fork (value = 1 , jvmArgsAppend = Array (" -Xmx1G" , " -Xms1G" , " -server " , " -XX:+AggressiveOpts " , " -XX:+UseCompressedOops" , " -XX:+AlwaysPreTouch" , " -XX:+UseCondCardMark" ))
16
16
@ Threads (value = 1 )
17
17
abstract class AbstractBaseFutureBenchmark {
18
18
// fjp = ForkJoinPool, fix = FixedThreadPool, fie = FutureInternalExecutor, gbl = GlobalEC
@@ -262,12 +262,12 @@ class AndThenFutureBenchmark extends OpFutureBenchmark {
262
262
}
263
263
264
264
class VariousFutureBenchmark extends OpFutureBenchmark {
265
- final val mapFun : Result => Result = _.toUpperCase
266
- final val flatMapFun : Result => Future [Result ] = r => Future .successful(r)
267
- final val filterFun : Result => Boolean = _ ne null
268
- final val transformFun : Try [Result ] => Try [Result ] = _ => throw null
269
- final val recoverFun : PartialFunction [Throwable , Result ] = { case _ => " OK" }
270
- final val keepLeft : (Result , Result ) => Result = (a,b) => a
265
+ private [ this ] final val mapFun : Result => Result = _.toUpperCase
266
+ private [ this ] final val flatMapFun : Result => Future [Result ] = r => Future .successful(r)
267
+ private [ this ] final val filterFun : Result => Boolean = _ ne null
268
+ private [ this ] final val transformFun : Try [Result ] => Try [Result ] = _ => throw null
269
+ private [ this ] final val recoverFun : PartialFunction [Throwable , Result ] = { case _ => " OK" }
270
+ private [ this ] final val keepLeft : (Result , Result ) => Result = (a,b) => a
271
271
272
272
@ tailrec private [this ] final def next (i : Int , f : Future [Result ])(implicit ec : ExecutionContext ): Future [Result ] =
273
273
if (i > 0 ) { next(i - 1 , f.map(mapFun).flatMap(flatMapFun).filter(filterFun).zipWith(f)(keepLeft).transform(transformFun).recover(recoverFun)) } else { f }
@@ -284,8 +284,8 @@ class VariousFutureBenchmark extends OpFutureBenchmark {
284
284
}
285
285
286
286
class LoopFutureBenchmark extends OpFutureBenchmark {
287
- val depth = 50
288
- val size = 2000
287
+ private [ this ] val depth = 50
288
+ private [ this ] val size = 2000
289
289
290
290
final def pre_loop (i : Int )(implicit ec : ExecutionContext ): Future [Int ] =
291
291
if (i % depth == 0 ) Future .successful(i + 1 ).flatMap(pre_loop)
0 commit comments