Skip to main content
Version: 2.0.3

๐ŸŽ๏ธ Benchmark

https://runkit.com/karbashevskyi/benchmark-is-is-js-thiis

thiisโ€‹

https://www.npmjs.com/package/thiis

Caseโ€‹

    if (thiis.is.object_not_empty(data)) {
// ...
}

Result: thiis x 1,530,187 ops/sec ยฑ0.55% (92 runs sampled)

vanillaโ€‹

Caseโ€‹

    if (typeof data === 'object' && data !== null && !Array.isArray(data) && Object.keys(data).length > 0) {
// ...
}

isโ€‹

https://www.npmjs.com/package/is

Caseโ€‹

    if (is.object(data) && !is.empty(data)) {
// ...
}

Result: is x 1,378,823 ops/sec ยฑ3.83% (88 runs sampled)

is_jsโ€‹

https://www.npmjs.com/package/is_js

Caseโ€‹

    if (is_js.object(data) && is_js.not.empty(data)) {
// ...
}

Result: is_js x 1,058,483 ops/sec ยฑ1.78% (90 runs sampled)

chaiโ€‹

https://www.npmjs.com/package/chai

Caseโ€‹

    chai.should();
if (data.should.not.be.empty) {
// ...
}

Result: chai x 148,122 ops/sec ยฑ1.96% (94 runs sampled)

Result: vanilla x 1,489,214 ops/sec ยฑ0.60% (92 runs sampled)

Conclusionโ€‹

As you can see, now the package is faster (>400%), it is not clear how, but for some reason this test shows that the package works even faster than vanilla javascript, which is practically impossible, since the proxy adds resistance to performance, but other various local tests show that the package is already at least in the top 3. Please, if there is an opportunity to test this package additionally, I will be grateful if you share the result.

As it was said in the previous version that a new version is being prepared that will get used to the work of the teams and as you can see it has been done.