[Haskell-cafe] FPS lib
Krasimir Angelov
kr.angelov at gmail.com
Tue Oct 18 15:14:34 EDT 2005
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:
> --import StringUtils.PackedString as PS
> import Data.FastPackedString as PS
>
> main = test1 [] 1000000
> --main = test2 [] 1000000
>
> test1 xs 0 = return ()
> test1 xs n =
> let x = PS.pack ("*****" ++ show n ++ "*****")
> in x `seq` test1 (x : xs) (n-1)
>
> test2 xs 0 = return ()
> test2 xs n =
> let x = PS.concat [PS.pack "*****", PS.pack (show n), PS.pack "*****"]
> in x `seq` test2 (x : xs) (n-1)
The detailed statistics are attached. Basically the results are:
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 |
My PackedString implementation is attached too.
Cheers,
Krasimir
-------------- next part --------------
test +RTS -stest1fs.stat
566,400,800 bytes allocated in the heap
8,394,100,944 bytes copied during GC (scavenged)
37,008 bytes copied during GC (not scavenged)
42,578,884 bytes maximum residency (7 sample(s))
1042 collections in generation 0 ( 95.94s)
7 collections in generation 1 ( 0.46s)
84 Mb total memory in use
INIT time 0.03s ( 0.00s elapsed)
MUT time 2.83s ( 2.82s elapsed)
GC time 96.40s ( 96.34s elapsed)
EXIT time 0.00s ( 0.00s elapsed)
Total time 99.26s ( 99.16s elapsed)
%GC time 97.1% (97.2% elapsed)
Alloc rate 197,765,642 bytes per MUT second
Productivity 2.9% of total user, 2.9% of total elapsed
-------------- next part --------------
test +RTS -stest1ps.stat
552,632,612 bytes allocated in the heap
96,049,260 bytes copied during GC (scavenged)
82,350,516 bytes copied during GC (not scavenged)
38,016,248 bytes maximum residency (7 sample(s))
1061 collections in generation 0 ( 0.66s)
7 collections in generation 1 ( 0.92s)
74 Mb total memory in use
INIT time 0.02s ( 0.00s elapsed)
MUT time 2.21s ( 2.20s elapsed)
GC time 1.58s ( 1.47s elapsed)
EXIT time 0.00s ( 0.00s elapsed)
Total time 3.81s ( 3.67s elapsed)
%GC time 41.5% (40.1% elapsed)
Alloc rate 247,484,376 bytes per MUT second
Productivity 58.0% of total user, 60.2% of total elapsed
-------------- next part --------------
test +RTS -stest2fs.stat
412,700,712 bytes allocated in the heap
6,411,611,864 bytes copied during GC (scavenged)
38,864 bytes copied during GC (not scavenged)
96,029,672 bytes maximum residency (8 sample(s))
762 collections in generation 0 (169.31s)
8 collections in generation 1 ( 2.87s)
189 Mb total memory in use
INIT time 0.01s ( 0.00s elapsed)
MUT time 3.69s ( 3.58s elapsed)
GC time 172.18s (171.91s elapsed)
EXIT time 0.00s ( 0.00s elapsed)
Total time 175.88s (175.49s elapsed)
%GC time 97.9% (98.0% elapsed)
Alloc rate 111,450,367 bytes per MUT second
Productivity 2.1% of total user, 2.1% of total elapsed
-------------- next part --------------
test +RTS -stest2ps.stat
1,361,661,680 bytes allocated in the heap
93,647,172 bytes copied during GC (scavenged)
80,446,868 bytes copied during GC (not scavenged)
35,585,988 bytes maximum residency (7 sample(s))
2616 collections in generation 0 ( 0.79s)
7 collections in generation 1 ( 0.83s)
69 Mb total memory in use
INIT time 0.02s ( 0.00s elapsed)
MUT time 3.64s ( 3.59s elapsed)
GC time 1.62s ( 1.58s elapsed)
EXIT time 0.00s ( 0.00s elapsed)
Total time 5.28s ( 5.17s elapsed)
%GC time 30.7% (30.6% elapsed)
Alloc rate 372,445,754 bytes per MUT second
Productivity 68.9% of total user, 70.4% of total elapsed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PackedString.hs
Type: application/octet-stream
Size: 23047 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/haskell-cafe/attachments/20051018/9f0c36f7/PackedString-0001.obj
More information about the Haskell-Cafe
mailing list