Socket
Socket
Sign inDemoInstall

alfaaz

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 1.0.4

15

dist/index.js

@@ -68,13 +68,8 @@ "use strict";

const bitIndex = charCode % BYTE_SIZE;
const charType = (BITMAP[byteIndex] >> bitIndex) & 1;
if (charType) {
if (!shouldCount && charCode < CHINESE_MIN_CODE_POINT)
continue;
count++;
shouldCount = false;
}
else
shouldCount = true;
const isMatch = (BITMAP[byteIndex] >> bitIndex) & 1;
// @ts-ignore allow JS to naturally coerce boolean into a number
count += isMatch && (shouldCount || charCode > CHINESE_MIN_CODE_POINT);
shouldCount = !isMatch;
}
// @ts-ignore
// @ts-ignore allow JS to naturally coerce boolean into a number
count += shouldCount;

@@ -81,0 +76,0 @@ return count;

{
"name": "alfaaz",
"version": "1.0.2",
"version": "1.0.4",
"description": "The fastest multilingual word counter that can count millions of words per second.",

@@ -15,2 +15,6 @@ "main": "dist/index.js",

"author": "Abdullah Atta <thecodrr@protonmail.com>",
"repository": {
"url": "https://github.com/thecodrr/alfaaz",
"type": "git"
},
"license": "MIT",

@@ -17,0 +21,0 @@ "devDependencies": {

@@ -217,4 +217,24 @@ <p align="center">

### How does this compare to `wc`?
`alfaaz` is much, much slower. Here's a quick benchmark I did with the Rust based `coreutils`.
```
Benchmark 1: coreutils wc -w .\benches\data\gulliver.txt
Time (mean ± σ): 21.2 ms ± 1.7 ms [User: 2.5 ms, System: 5.2 ms]
Range (min … max): 18.1 ms … 27.4 ms 73 runs
Benchmark 2: node test.js
Time (mean ± σ): 131.3 ms ± 9.1 ms [User: 31.3 ms, System: 22.3 ms]
Range (min … max): 123.4 ms … 151.2 ms 20 runs
Summary
'coreutils wc -w .\benches\data\gulliver.txt' ran
6.18 ± 0.65 times faster than 'node test.js'
```
This is to be expected since just the startup time of NodeJS is > 21ms.
## Other projects
1. [fdir](https://github.com/thecodrr/fdir) - The fastest NodeJS directory crawler & globber.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc