Summary

I l @ ve RuBoard

There's nothing wrong with optimizing complex data structures. The bad news is that some very common optimization methods actually aren't always optimizations at all, and can exact performance penalties that will get more noticeable as more of us write multithreaded programs or share libraries with others who do ” especially when the libraries are written needlessly inefficiently because of inexperience with thread safety issues.

The good news is that other optimizations can give the same effect, but don't have performance impacts in multithreaded mode. For example, in C++, providing optimized custom allocators via a custom operator new() is usually a good way to deal with memory allocation performance issues. For strisgs, in particular, the small-string optimization (storing small strings inside the String object itself rather than in a separate buffer), delivers solid performance results time after time, avoiding memory allocations entirely for strings below a threshold size .

The trick is to use a true optimization, not a false optimization that, often unintentionally, optimizes library code only for single-threaded use.

I l @ ve RuBoard


More Exceptional C++
More Exceptional C++: 40 New Engineering Puzzles, Programming Problems, and Solutions
ISBN: 020170434X
EAN: 2147483647
Year: 2001
Pages: 118
Authors: Herb Sutter

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net