JSPM

tinystring

0.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q38107F
  • License BSD

Tiny string builder on top of std::stringstream

Package Exports

  • tinystring

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tinystring) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

tinystring Build Status

A tiny wrapper around std::stringstream.

Installation

npm install tinystring

Example

var TinyString = require('tinystring');

var str = new TinyString();

str.append('one');
str.append('two');
str.append('three');

console.log(str.value());
// 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: 1.2 GB
heapTotal: 1.1 GB
heapUsed: 1013.7 MB

-tinystring-
total: 402 MB
heapTotal: 28.8 MB
heapUsed: 22.9 MB