Skip to content

Commit

Permalink
add section about benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
tabcat committed Apr 21, 2024
1 parent 00ff3f2 commit 75425f7
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,28 @@ May be useful in the following cases:

If none of these apply, it's probably better to implement the needed operations using Javascript's Set class.

### Benchmarks

There's a very simple benchmark comparing the set operations difference, symmetric difference, union and intersection implemented in this library versus an implementation using Set.

```
pnpm install
pnpm benchmark
```

Output should look something like this:

```
difference impl: Set size: 1000 x 39,330 ops/sec ±0.95% (94 runs sampled)
difference impl: ordered-sets size: 1000 x 34,476 ops/sec ±0.27% (98 runs sampled)
symmetric impl: Set size: 1000 x 80,485 ops/sec ±1.22% (93 runs sampled)
symmetric impl: ordered-sets size: 1000 x 25,945 ops/sec ±0.28% (101 runs sampled)
union impl: Set size: 1000 x 45,971 ops/sec ±1.13% (91 runs sampled)
union impl: ordered-sets size: 1000 x 25,897 ops/sec ±0.31% (98 runs sampled)
intersection impl: Set size: 1000 x 44,982 ops/sec ±0.62% (95 runs sampled)
intersection impl: ordered-sets size: 1000 x 36,325 ops/sec ±0.43% (99 runs sampled)
```

## Extension

If you have a usecase for a missing feature be sure to make an issue.
Expand Down

0 comments on commit 75425f7

Please sign in to comment.