serial versus parallel isPrime function, parallelization is not always interesting...
Parallel implementation of isPrime function based on promise and futures generates sometime too much overhead in comparison to the simple one. In fact it is really faster with prime number... but with not prime numbers it won't be always the case. So how to decide which implementation is best for a given number, ... no idea yet Full code is available here.
$ sbt 'test-only fr.janalyse.primes.IsPrimesTest'
[info] - isPrimePara tests
[info] - isPrime mono versus parallel tests
[info] + duration for 10000 : 1050ms serial processing, highest prime 104729
[info] + duration for 10000 : 5451ms parallel processing, highest prime 104729 (ForkJoinPool)
[info] + duration for 10000 : 13384ms parallel processing, highest prime 104729 (CachedThreadPool)
[info] - very big prime test
[info] + duration for 17436413019234331 : 22063ms sequential isPrime
[info] + duration for 17436413019234331 : 5839ms parallel isPrime (ForkJoinPool)
[info] + duration for 17436413019234331 : 5848ms parallel isPrime (CachedThreadPool)