Skip to content

anonrig/fast-array-join

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fast-array-join

NPM version

fast-array-join is a %61 faster array join function compared to Array.prototype.join.

Taken from Node.js repository and authored by @BridgeAR

Installation

npm i fast-array-join 

Usage

const fastJoin = require('fast-array-join') const input = ['hello', 'world'] console.log(fastJoin(input, ' ')) // "hello world"

Benchmark

> node benchmark/native-vs-js.mjs ╔══════════════════════╤═════════╤══════════════════╤═══════════╗ ║ Slower tests │ Samples │ Result │ Tolerance ║ ╟──────────────────────┼─────────┼──────────────────┼───────────╢ ║ Array.prototype.join │ 4500 │ 96622.01 op/sec │ ± 1.00 % ║ ╟──────────────────────┼─────────┼──────────────────┼───────────╢ ║ Fastest test │ Samples │ Result │ Tolerance ║ ╟──────────────────────┼─────────┼──────────────────┼───────────╢ ║ fast-array-join │ 10000 │ 155072.20 op/sec │ ± 2.08 % ║ ╚══════════════════════╧═════════╧══════════════════╧═══════════╝``` 

About

61% faster array join for JavaScript.

Topics

Resources

License

Stars

Watchers

Forks

Contributors