Hash benchmarks
Vasily Chekalkin
bacek at bacek.com
Thu Mar 15 00:51:37 UTC 2012
Yay!
Can you also try parrot with int keys and float values? Just for curiosity.
--
Bacek
On Thu, Mar 15, 2012 at 11:30 AM, Luben Karavelov <karavelov at spnet.net> wrote:
> Hello guys,
>
> I was looking for a way to speed up some heavy computations
> we are making @work so I have written small benchmark that:
>
> 1. reads 5000 sparse vectors from disk
> 2. computes inner product of the last 100 vectors
> with all the vectors before them
>
> The representation that we are using for sparse vectors is
> hash tables. I have written this small test case in
> several languages, including PIR. In every program the load
> time is under 2 seconds and the math is quite simple, so
> what this is stress testing hash tables code.
>
> Here are the results (some of them surprising)
>
> time mem
> clojure 32 449536
> racket 70 168060
> c++ 40 75180 map<int,float>
> c++ 43 68960 unordered_map<int,float>
> perl 33 117904
> lua 26 108540
> luajit 6 68072
> haskell 23 1027504 Data.IntMap Float (compiled)
> parrot 28 360992 Hash PMC_keys PMC_vals
> parrot 15 263628 Hash int_keys PMC_vals
>
> So, my small comment: we are not bad at all. Luajit comes
> first but we are quite fast even without JIT.
>
> The biggest disappointment for me are statically typed
> compiled languages - they had all the time to optimize
> the code, they had proper information in order to use
> native, unboxed values but their performance is quite bad
> C++ uses 7x the time of the first (luajit) and haskel
> uses 10x times the memory.
>
> Another observation: it looks like luajit infers key and
> value datatypes and stores them unboxed.
>
>
> I hope you find this interesting
> Best regards
>
> --
> Luben Karavelov
> _______________________________________________
> http://lists.parrot.org/mailman/listinfo/parrot-dev
More information about the parrot-dev
mailing list