5 ms·
> IMHO, such a big difference only arrises when big differences in algorithmic complexity is involved. No, this arises as the result of large constant factors,
by rbehrends 12y ago
> IMHO, such a big difference only arrises when big differences in algorithmic complexity is involved.
No, this arises as the result of large constant factors, too. As I pointed out, log2(1e6) is approximately a factor of 20 alone and you pay additional constant overhead for having suboptimal memory layout and allocations. Remember, while functional programming languages love trees and linked lists, the hardware loves contiguous arrays. This is what the L1 and L2 cache and prefetching logic of your typical CPU are optimized for.