tinystring
A tiny wrapper around std::stringstream
.
Installation
npm install tinystring
Example
var TinyString = ; var str = ; str;str;str; console;// onetwothree
Performance
The goal is to minimize the memory usage when building up huge strings. In most cases using a stream is a better design, but this is for cases where that might not be possible.
var base = 'This is a test string'; var str = ''; for var i = 0; i < 8000000; ++i str += i + ' : ' + base; -builtin-total: 12 GBheapTotal: 11 GBheapUsed: 10137 MB -tinystring-total: 402 MBheapTotal: 288 MBheapUsed: 229 MB