mobily/ts-belt

Ts-belt is 4x slower because it uses the arguments object

Opened this issue · 0 comments

icetbr commented

Hi, I'm no expert, this is just an experiment I made using the code from ts belt.

https://github.com/icetbr/experiments/tree/main/perf/packages/arguments

Quoting from my repo:

const filterArgs = function () {
    var n = arguments[0];
    var t = arguments[1];

can be 4x slower than

const filter = function (n, t) {
arguments 1 x 4,193,813 ops/sec ±0.83% (23 runs sampled)
arguments 2 x 1,021,724 ops/sec ±2.65% (22 runs sampled)
direct 1    x 4,188,578 ops/sec ±0.77% (21 runs sampled)
direct 2    x 4,137,680 ops/sec ±0.87% (18 runs sampled)