Boost logo

Boost :

From: Nathan Myers (ncm_at_[hidden])
Date: 1998-12-08 17:11:57

Greg wrote:
> My testing so far shows that the differences between the versions are
> in the 5% to 10% range, and which version is faster depends on many
> factors. I've been filling up vectors and lists with a million calls
> to shared_ptr<int>(new rand()) and then doing a sort. If the comparison
> function takes its arguments my reference direct wins, if by value
> indirect wins. I've also tried running 8 sorts of a half million items
> at once, which caused my dual-300MHz 128MB NT box to thrash like a
> captured alligator, but revealed no consistent differences in direct
> versus indirect.

I'm thrilled to see Greg doing testing.

A system that's thrashing doesn't tell you much, by itself.
If you found a problem size that was on threshold of thrashing, so
that for N items it runs in core but for 2N it thrashes, then you
could compare approaches at values between N and 2N to see which
induces thrashing first. But virtual memory performance is a
very gross measure, subject to artifacts.

For programs that run in core, patterns really matter. If your
benchmark takes advantage of, or fails to take advantage of a
correlation of allocations of objects, then it will not represent
a program which makes the opposite choice. For a benchmark to
tell us much, we may have to contrive cases where one approach
really differs from the other, and then decide how plausible the
contrivances are.

As Herb likes to say, "don't guess, measure!"; and as I like
to say, "measure, but don't measure the wrong damn thing!".
Statistics stripped of their context exert an evil influence.

Nathan Myers

Free Web-based e-mail groups --

Boost list run by bdawes at, gregod at, cpdaniel at, john at