nstream Performance - novalexei/nstream GitHub Wiki
Performance test
This is very quick and informal performance test of various string streams. In this test we write random integer into string using C++ output stream and read it back from that string with input stream and make sure that initial and resulting numbers are equal. The contestants:
- Standard std::istringstream/std::ostringstream
- boost::iostreams with sink and source described in boost::iostreams tutorial
- nova::stream with in_buffer_provider and out_buffer_provider described in sections "Writing input stream with in_buffer_provider" and "Writing output stream with out_buffer_provider" with minor change in out_buffer_provider to implement small string optimization.
The results (with gcc 7.2):
stream | Execution time (ms) | Compiled size delta in bytes (stripped) |
---|---|---|
std::stringstream | 6002 | 8224 |
boost::iostreams | 4567 | 24704 |
nova::stream | 3890 | 8272 |
Back to the Tutorial