-
More Erlang Beust Challenge Results (incl. HiPE)
2008-09-04 17:21 in /tech/erlang
I’ve been tinkering a little more with the Beust Challenge, following up on my previous post. There are a couple significant new developments to report.
First, Hynek (Pichi) Vychodil wrote a faster version using a permutation generator.
Second, I also ported the first “CrazyBob” solution using a bit mask to Erlang.
Third, I discovered that my overly literal ports were actually slowing things down. The CrazyBob code uses an unspecified Listener class that receives the numbers in the series, and presumably computes the actual results from there. (Aside, I cannot actually benchmark against the Java code because I haven’t found what this implementation is.) I fudged this in my original ports by simply spawning a process, which then discarded all the messages it received. After I noticed that the code was pegging both of my CPUs, though, I realized that message passing might actually be the bottleneck in my code. Turns out this was the case, and removing the listener process and just computing the results in the main process actually sped things up substantially.
Finally, I got access to a machine with HiPE enabled.
So... here’s the results. First on my MacBook Pro, without HiPE:
log(Max) Original bitmask crazybob pichi 4 8ms 2ms 3ms 3ms 5 65ms 11ms 13ms 14ms 6 632ms 52ms 69ms 62ms 7 6.7s 253ms 303ms 272ms 8 72s 1.0s 1.0s 945ms 9 18m 4.7s 3.6s 2.8s 10 (3h) 13s 7.8s 5.3s The bitmask solution starts out the fastest, but loses out in the end to the more clever solutions. pichi edges out the crazybob solution by about a third.
Now on Linux 2.6 with HiPE:
log(Max) Original bitmask crazybob pichi 4 4ms <1ms 1ms 2ms 5 50ms 1ms 6ms 7ms 6 608ms 7ms 34ms 37ms 7 6.9s 35ms 160ms 174ms 8 78s 147ms 619ms 563ms 9 (18m) 460ms 1.8s 1.4s 10 (3h) 1.1s 4.2s 2.4s And our new winner is... bitmask! HiPE barely helps the original brute-force solutions at all, while crazybob and pichi gain about a factor of two. bitmask, on the other hand, picks up an order of magnitude, and is now only a factor of 3 slower than the posted results for the Java crazybob solution (with unknown differences in hardware).
Conclusion: Erlang doesn’t suck!
Leave a comment
Please use plain text only. No HTML tags are allowed.