SkillAgentSearch skills...

Tinystring

A tiny wrapper around std::stringstream for efficient string building in Nodejs

Install / Use

/learn @zhm/Tinystring
About this skill

Quality Score

0/100

Supported Platforms

Universal

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
View on GitHub
GitHub Stars7
CategoryDevelopment
Updated6y ago
Forks0

Languages

C++

Security Score

70/100

Audited on Aug 18, 2019

No findings