Benchmark string copying via the formatter
Summary:
Using the formatter is always much slower than using the copy constructor (News at 11).
Comparing the two idioms for formatting out a single string input:
* the unsafe method (`format(theString)`) is (annoyingly) fastest for small strings; probably because cache-hits dominate the need to inspect every character to see if it is `{` or `}`
* the safe method (`format("{}",theString)`) is fastest on large strings (crossover at roughly 256 bytes)
* there isn't a lot in it between 64 and 512 bytes.
Reviewed By: yfeldblum
Differential Revision: D4423088
fbshipit-source-id: 7f8590653ab33fe62887a506ea79a43989fbfb29
Showing
Please register or sign in to comment