[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Use of Variants
From: |
Akim Demaille |
Subject: |
Re: Use of Variants |
Date: |
Fri, 18 Jul 2008 18:11:22 +0200 |
Well, I have now better results without Boost Variants. More
work is still needed, but it is now faster with (Bison) variants
than with the union (which is expected, since the later makes
heavy use of malloc to store pointers to objects instead of objects).
This is in addition of a +10% speed up I had in lalr1.cc by fusing
the three stacks into a single one.
$ _build/i386-apple-darwin9.4.0/etc/bench.pl --cflags=-O2 -i
400
Subroutine
Benchmark::mytime redefined at /System/Library/Perl/5.8.8/
Benchmark.pm line 459.
Benchmark: timing 400 iterations of f-union, f-union-debug, f-
variant, f-variant-debug...
f-union: 1.92616 wallclock secs ( 1.14 cusr + 0.48 csys = 1.62
CPU) @ 246.91/s (n=400)
f-union-debug: 1.94717 wallclock secs ( 1.15 cusr + 0.48 csys =
1.63 CPU) @ 245.40/s (n=400)
f-variant: 1.86092 wallclock secs ( 1.04 cusr + 0.49 csys = 1.53
CPU) @ 261.44/s (n=400)
f-variant-debug: 1.84779 wallclock secs ( 1.05 cusr + 0.48 csys =
1.53 CPU) @ 261.44/s (n=400)
Rate f-union-debug f-union f-variant-
debug f-variant
f-union-debug 245/s -- -1%
-6% -6%
f-union 247/s 1% --
-6% -6%
f-variant-debug 261/s 7% 6%
-- -0%
f-variant 261/s 7% 6%
0% --
Sizes:
f-union: 37kB
f-variant: 37kB
f-variant-debug: 42kB
f-union-debug: 42kB
There is not even (currently) any significant penalty on the
size.
This is much better than what I have yesterday, with stock Boost
Variants:
union: 38.9151 wallclock secs (22.03 cusr + 9.36 csys =
31.39 CPU) @ 233.51/s (n=7330)
union-debug: 36.3611 wallclock secs (20.65 cusr + 8.93 csys =
29.58 CPU) @ 231.71/s (n=6854)
variant: 47.37 wallclock secs (32.54 cusr + 8.88 csys =
41.42 CPU) @ 169.07/s (n=7003)
variant-debug: 48.9951 wallclock secs (33.82 cusr + 9.30 csys =
43.12 CPU) @ 169.78/s (n=7321)
Rate variant variant-debug union-debug
union
variant 169/s -- -0%
-27% -28%
variant-debug 170/s 0% --
-27% -27%
union-debug 232/s 37% 36%
-- -1%
union 234/s 38% 38%
1% --
Sizes:
variant: 108kB
variant-debug: 120kB
union: 65kB
union-debug: 69kB
- Use of Variants, Akim Demaille, 2008/07/18
- Re: Use of Variants,
Akim Demaille <=