fast-array-join

1.0.0 • Public • Published

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 % ║
╚══════════════════════╧═════════╧══════════════════╧═══════════╝```

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i fast-array-join

    Weekly Downloads

    2

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    4.96 kB

    Total Files

    8

    Last publish

    Collaborators

    • anonrig