2 ms·
For any interested, I wrote up a Haskell version[1]. Initially, it was immensely slow (~ 2 minutes); however, switching over to unboxed vectors brought it to be
by thinkpad20 12y ago
For any interested, I wrote up a Haskell version[1]. Initially, it was immensely slow (~ 2 minutes); however, switching over to unboxed vectors brought it to be on par with OCaml. There are still opportunities for improvement.
[1] http://lpaste.net/105413 http://lpaste.net/105413
- thinkpad20 12y agoAnd here's one that runs in half that time (or possibly less if you have a lot of cores)[1]. Speedups due to suggestions in this thread[2]. EDIT: now runs in parallel and is faster than the Rust single-threaded version, and on par with the parallel Rust version, but only ~35 lines. [1] http://lpaste.net/105456 http://lpaste.net/105456 [2] http://www.reddit.com/r/haskell/comments/27tcvz/knearest_neighbors_in_haskell_is_elegant_but_slow/ http://www.reddit.com/r/haskell/comments/27tcvz/knearest_nei...