hanafey (18) [Avatar] Offline
#1
In Listing 5.6 there is the line "repeat.times {worker(it)}", but worker is already a closure so it seems "repeat.times(worker)" is more direct. Wrapping the closure in another closure is not incorrect, but in my testing the direct call is twice as fast when benchmarking the the fast "intdiv" operation (for 100,000 iterations 4 ms vs. 8 ms. I ran the benchmarks repeatedly so that the execution times settle done after the hot spot compiler does its thing.