Another C++ entry

Levi Pearson levi at
Wed Mar 22 16:37:20 MST 2006

On Mar 22, 2006, at 4:25 PM, Sasha Pachev wrote:

> I believe this is still slower than a Perl solution. You cannot  
> crush a scripting language with C++ if all you do is create objects  
> and issue calls in a loop. That is essentially what a scripting  
> language would do. Driven only in first gear, a hot sports car will  
> not outrun my GMC Safari 95 van.
> In order to have C++ truly crush everything else, you must abandon  
> STL, object creation in a loop, redundant copying of the data, and  
> other performance killers. Use your own hand-crafted hash. Compute  
> the hash index in a loop as you process each character. Or you  
> might actually do better organizing the dictionary into a sorted  
> list, and using an incremental binary search. Or maybe put the  
> dictionary in a tri.
> Also fine tune the I/O to eliminate waste. Have a buffer, read  
> chunks into it, then deal with each chunk in place one at a time.  
> Do not copy anything if you can at all avoid it! Figure out a way  
> to deal with the words being chopped off at the end of I/O block.  
> In short, you have essentially full control on the CPU level - use it!
> Anybody wants to shake his C/C++ muscle?

Sane people only do that sort of thing when it's absolutely required,  
and this is not such a case.  Maybe you want them to, to see who you  
want to hire, but that's likely insufficient motivation for most of  
us who would rather write a program to do something interesting  
slowly than something mind-numbingly dull extremely quickly.

Sorry to disappoint you!


More information about the PLUG mailing list