
2005/10/19, Donald Bruce Stewart
kr.angelov:
Hello Guys,
I tried my own version of PackedStrings and the results are very nice. It is entirely based on ByteArray# and Int#. I have made two tests:
Elapsed time | | FastPackedString | PackedString | +-----+------------------+--------------+ |test1| 99.26s | 3.81s | |test2| 175.88s | 5.28s |
Maximum Memory Residency | | FastPackedString | PackedString | +-----+------------------+--------------+ |test1| 40.60Mb | 36.25Mb | |test2| 91.58Mb | 33.94Mb |
Wow. Now this is really surprising.
Firstly, I would point out that only testing pack and concat may be slightly unrepresentative :)
Of course the representative benchmark needs more test cases.
However, on my machine:
OpenBSD/Pentium-M 1.6G/ghc-6.5 -O Elapsed time: FPS Simon's PackedString Krasimir's test1 1.966s (40M) 2.151s (36M) 2.235s (36M) test2 6.048s (24M) 3.160s (73M) 2.318s (39M)
Which is basically what I expected. Though perhaps I need to improve concat (we currently do things a little strangely in concat, due to the darcs legacy), but pack itself is nice and fast.
Linux/Pentium 4 3.6G/ghc-6.4.1 -O test1 35.37s 30.97s 2.180s test2 90.93s 60.55s 1.916s
Ah!! So what's going on on Linux, I wonder. Could it be something about 6.4.1? Are we seeing the difference between ForeignPtrs from 6.4 to 6.5? I will investigate.
I wonder why the test results are so different. I made my benchmark on WinXP on Celeron 3GHz with GHC from CVS HEAD. Cheers, Krasimir