Boost logo

Boost :

Subject: [boost] [XInt] CoW/Move Timings
From: Chad Nelson (chad.thecomfychair_at_[hidden])
Date: 2011-03-09 20:23:55


Below are the comparative timings with and without Copy-on-Write, and
with and without Boost.Move.

Times are measured in seconds, using two sets of ten integers (512,
2048, and 8192 bit). The tests consisted of adding each of those pairs
of numbers together 10,000 times, multiplying them 10,000 times, and
doing a "mulmod" operation on them (with a third randomly-generated
modulus argument of the same size) 1,000 times. Each test was run three
times, under as close to identical situations as I could manage, with
the raw results in the first three columns; the fourth column is the
average of the three.

The compiler used was GCC 4.5.1, under Ubuntu Linux 10.10. The build
was non-debug and used -O2 optimization. Otherwise, the
settings were left at their defaults.

The "review code" lines are for the unmodified review version of the
code. All others are for the pass-by-reference version, with several
other modifications that should have no measurable effect on the speed.

The tests show pretty conclusively that Copy-on-Write, alone or in
conjunction with Boost.Move, provides a noticeable speed improvement
on all three sizes. They also prove that Boost.Move can work well in
conjunction with it. I'll leave any further analysis to people who are
probably more qualified than I.

Note that the Boost.Move numbers could be a little better. The
integer_t classes are move-enabled, but the internal data class is not
as yet. The data class only sometimes uses return values, so the
difference isn't likely to be great.

I will make the updated code available on request for anyone who wants
to examine the changes.

512bit
CoW, no Move: 0.48, 0.47, 0.47: 0.48
No CoW, no Move: 0.61, 0.61, 0.62: 0.61 (worst)
No CoW, Move: 0.57, 0.57, 0.55: 0.56
CoW, Move: 0.44, 0.44, 0.44: 0.44 (best)

Review code,
  CoW, no Move: 0.50, 0.47, 0.47: 0.48

2Kbit
CoW, no Move: 4.69, 4.79, 4.89: 4.79 (best)
No CoW, no Move: 5.01, 5.19, 5.06: 5.09 (worst)
No CoW, Move: 5.18, 5.00, 5.01: 5.06
CoW, Move: 4.80, 4.79, 4.86: 4.82

Review code,
  CoW, no Move: 4.88, 4.85, 4.94: 4.89

8Kbit
CoW, no Move: 68.0, 68.8, 68.9: 68.6
No CoW, no Move: 70.4, 70.4, 70.2: 70.3 (worst)
No CoW, Move: 70.9, 69.8, 69.6: 70.1
CoW, Move: 68.4, 68.2, 67.8: 68.1 (best)

Review code,
  CoW, no Move: 68.8, 68.4, 68.8: 68.7

-- 
Chad Nelson
Oak Circle Software, Inc.
*
*
*



Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk