Skip to content

Commit

Permalink
Update benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
eilvelia committed Apr 29, 2024
1 parent 4c204df commit de2db34
Show file tree
Hide file tree
Showing 9 changed files with 2,000,076 additions and 73 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist/*.js linguist-generated=true
bench/bench-set.js linguist-generated=true
*.flow linguist-language=JavaScript
5 changes: 0 additions & 5 deletions CHANGELOG.md

This file was deleted.

34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,44 +39,44 @@ The code is compatible with ES5. TypeScript type declarations are included.

## Benchmarks

On my machine, the 29.4k test suite executes in ~10 ms (~3M/s throughput) in a
On my machine, the 29.4k test suite executes in ~9.5ms (~3M/s throughput) in a
hot loop (~70ms for the first run).

The benchmark code is in `bench/index.js`.

Here is a comparison with some other libraries (you probably should take it with
a little grain of salt):

| library | throughput |
| ------------------------------------ | ------------- |
| porter2.js | 3120 kops/s |
| [stemr][] | 354 kops/s |
| [wink-porter2-stemmer][] [^1] | 168 kops/s |
| library | throughput (node) | throughput (bun) |
| ------------------------------------ | ----------------- | ---------------- |
| porter2.js | 3118 kops/s | 3283 kops/s |
| [stemr][] | 342 kops/s | 367 kops/s |
| [wink-porter2-stemmer][] [^1] | 162 kops/s | 174 kops/s |

[stemr]: https://github.com/localvoid/stemr
[wink-porter2-stemmer]: https://github.com/winkjs/wink-porter2-stemmer

Here are libraries that implement older porter 1 (note the behavior is not
identical):

| library | throughput |
| ------------------------------------ | ------------- |
| [porter-stemmer-js][] [^2] | 1430 kops/s |
| [stemmer][] [^3] | 1121 kops/s |
| [@stdlib/nlp-porter-stemmer][] | 839 kops/s |
| [porter-stemmer][] | 514 kops/s |
| library | throughput (node) | throughput (bun) |
| ------------------------------------ | ----------------- | ---------------- |
| [porter-stemmer-js][] [^2] | 1422 kops/s | 1484 kops/s |
| [stemmer][] [^3] | 1064 kops/s | 623 kops/s |
| [@stdlib/nlp-porter-stemmer][] | 842 kops/s | 685 kops/s |
| [porter-stemmer][] | 497 kops/s | 520 kops/s |

[porter-stemmer-js]: https://github.com/evi1Husky/PorterStemmer
[stemmer]: https://github.com/words/stemmer
[@stdlib/nlp-porter-stemmer]: https://github.com/stdlib-js/nlp-porter-stemmer
[porter-stemmer]: https://github.com/jedp/porter-stemmer

This is tested with Node.js v20.12.2. bun v1.1.4 shows a little bit different
but comparable results.
The benchmark code is in `bench/run.mjs`.

This is tested with Node.js v20.12.2 and bun v1.1.4. The library versions are
latest as of 2024-04-29.

[^1]: 99.97% porter2 compliant (fails on `'` cases only)

[^2]: That one has similar goals and, surprisingly, was published just 3 days
before this package was released! (And after I started working on it.)
before this package was released! (And after I started working on porter2.js.)

[^3]: ESM only
Loading

0 comments on commit de2db34

Please sign in to comment.