FYI - the omnibox jank I was seeing is gone in 41.0.2220.0 dev channel.
Anecdotes are not data, but here's an anecdote about vector::reserve(). I went to a talk at GDC back in the original Xbox days. Microsoft maintained an internal lab where they would bring in developers of high profile games and help them optimize their source. Not interesting. But they also maintained a database of every individual optimization they implemented, grouped them by class and collected statistics on impact.
Many games build lists of things during their main loop. One of the largest impact changes was making sure all these vectors called std::vector::reserve() with a reasonable number.
Caveats: I have no real data. I have no idea what allocator they were using. But if you have a guess at the size of your vector, a call to reserve() probably doesn't hurt.
+1 to const std::string& over char*. :-)
Kudos to the Syzygy team for noticing this and bringing it up.
James On Tue, Dec 2, 2014 at 7:37 AM, Alex Vakulenko <avaku...@chromium.org> wrote: - If you control the whole tree of functions below you, or are a leaf, then lean towards const StringPiece&. Otherwise, lean towards const std::string&.
Should we lean towards StringPiece and not const StringPiece& instead? I've read numerous reports from C++ library team recommending to pass StringPiece by value instead by reference.
|