I and others noticed that the javascript solution posted was far from optimal. So for fun, I tried optimizing both it and the algorithm used. The end result runs almost 20,000 times faster and handily beats all implementations in the original post, including the carefully optimized C++11 one by almost 1000x.
As I say in the gist: it's still about the algorithm, not the language.
1 comment
[ 0.20 ms ] story [ 14.8 ms ] threadI and others noticed that the javascript solution posted was far from optimal. So for fun, I tried optimizing both it and the algorithm used. The end result runs almost 20,000 times faster and handily beats all implementations in the original post, including the carefully optimized C++11 one by almost 1000x.
As I say in the gist: it's still about the algorithm, not the language.