reduce memory consumption

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
concatenation
const tokens = [ ...Array(10000).keys() ].map( i => ''+i);

result = tokens.reduce((rows, token, j) => {
            const row = `{borrower_id},{token.id},{routing_number}\n`;
            return rows + row;
        }, '');
ready
push
const tokens = [ ...Array(10000).keys() ].map( i => ''+i);

const resultArray = tokens.reduce((rows, token, j) => {
            const row = `{borrower_id},{token.id},{routing_number}\n`;
    rows.push(row);
    return rows;
}, []);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.