Hacker News new | past | comments | ask | show | jobs | submit login

Small string optimization doesn't help that much. Chrome's use of std::string accounts for almost half of all allocation: https://groups.google.com/a/chromium.org/forum/#!msg/chromiu...



As always it would depend on the context of usage whether the allocations would be problematic. Use of SGI STL::rope<T, Alloc>[0] has helped me in the past in a similar scenario. It is part of SGI stl implementation that did not make it into part of the standard library specification although it should have, imho.

Essentially ropes are character strings represented as a tree of concatenation nodes optimized for immuatability. A rope may contain shared subtrees so is really a directed acyclic graph where the out-edges of each vertex are ordered. Kind of search trees that are indexed by position.

[0]: https://www.sgi.com/tech/stl/Rope.html [1]: [pdf] http://www.cs.rit.edu/usr/local/pub/jeh/courses/QUARTERS/FP/...


That doesn't mean that allocations are a big part of chrome's performance, and in fact I would guess that they aren't since allocations are a large performance win and chrome is optimized.

Also, chrome being a web browser means a huge part of the program is strings.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: