Aug. 27th, 2004

redis: (stupid)
Выдержка из технического описания GNU C++ STL (libstdc++):

" CString suffers from a common programming error that results in
poor performance. Consider the following code:

CString n_copies_of (const CString& foo, unsigned n)
{
CString tmp;
for (unsigned i = 0; i < n; i++)
tmp += foo;
return tmp;
}

This function is O(n^2), not O(n). The reason is that each +=
causes a reallocation and copy of the existing string. Microsoft
applications are full of this kind of thing (quadratic performance
on tasks that can be done in linear time) -- on the other hand,
we should be thankful, as it's created such a big market for high-end
ix86 hardware.
:-)

If you replace CString with string in the above function, the
performance is O(n)."

Это должно быть смешно для тех, кто поймет, о чем идет речь :)

Profile

redis: (Default)
redis

September 2025

S M T W T F S
 12 3456
789 1011 12 13
14 151617181920
212223 24252627
282930    

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 27th, 2025 05:36 am
Powered by Dreamwidth Studios