Guest User

Untitled

a guest
Jan 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. import scala.testing.Benchmark
  2. import scala.collection.immutable.NumericRange
  3. object FactParallel extends Benchmark {
  4. def run {
  5. def fac(n: BigInt): BigInt = NumericRange(BigInt(1), n, BigInt(1)).foldLeft(BigInt(1))(_*_)
  6. (1 to 2000).par.map{x => /* printf("x = %02d:%s%n", x, Thread.currentThread.toString); */ fac(x) }
  7. }
  8. }
Add Comment
Please, Sign In to add comment