Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import scala.testing.Benchmark
- import scala.collection.immutable.NumericRange
- object FactParallel extends Benchmark {
- def run {
- def fac(n: BigInt): BigInt = NumericRange(BigInt(1), n, BigInt(1)).foldLeft(BigInt(1))(_*_)
- (1 to 2000).par.map{x => /* printf("x = %02d:%s%n", x, Thread.currentThread.toString); */ fac(x) }
- }
- }
Add Comment
Please, Sign In to add comment