Another C++ entry

Michael Halcrow mike at
Thu Mar 23 12:38:56 MST 2006

On Wed, Mar 22, 2006 at 09:55:50PM -0700, Dave Smith wrote:
> Bryan, could you run this code on your benchmark box? I'm curious
> how it compares with the others.

What about correctness? I thought through several ``shortcuts'' that
would give correct results 99.9% of the time and would probably run
faster than any of the solutions given so far. I could easily submit
them here and have them evaluated, keeping my mouth shut about the
0.1% of the time when it wouldn't work (i.e., when there are more than
65,535 instances of any given word), and yet win the contest because
of the specific test case scenario and the fact that my code may not
be deeply scrutinized/formally verified. Things like the nuances of
memory management make all the difference.

And are we dealing with wall clock time or total cycles on any given
architecture? If it's wall clock time, can I construct an image of a
data structure to copy into a RAM drive, and then mmap than image? The
amount of RAM would make a huge impact then; the difference between
512MB and 3GB could cut the runtime in half. And then there is L2
cache size to consider, and L1 cacheline size, and register size (32-
or 64-bit), and multi-core/multi-threaded processing (fork and have
the child work on the 2nd half of the file on the other processor, and
then add the results from the two processes at the end), and so
forth. When it's all done, does the program need to print every word
in the dictionary along with the number of instances, whether that
number is 0 or not, or does it only print the wordcount of the words
for which there is at least 1 instance (this might matter, for
instance, during the data structure tree traversal time at the end of
the counting process)? If I can't do the RAM disk thing, then how slow
is my I/O? That will impact how much work I want the CPU to do vs. how
much seeking/reading I do on the disk.

So in short, without much more strictly defined controls, I would say
that the wall clock running time is pretty much meaningless for this
particular competition.

If this is flashing then you're a winner!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 481 bytes
Desc: Digital signature
Url : 

More information about the PLUG mailing list