Skip to content

Commit

Permalink
perf(no-release): refactor benchmarks & add another bench
Browse files Browse the repository at this point in the history
  • Loading branch information
norskeld committed May 14, 2022
1 parent bc19fdb commit 11d42b4
Show file tree
Hide file tree
Showing 14 changed files with 354 additions and 64 deletions.
8 changes: 4 additions & 4 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ Here you will find some benchmarks and rough performance comparison with similar

Unfortunately, it's difficult to come up with sensible benchmarks, given that how a parser written with **sigma** depends entirely on what you are parsing, how you structure your parser(s), which patterns the parser attempts to match first, what is involved in constructing your AST (if any), and so on.

All that said, here are some rough numbers from the [JSON parsing benchmark][json-bench] (running on my MacBook Pro 16" with `Intel i9-9880H @ 2.30GHz` and `Node@14`).
All that said, here are some rough numbers from the [JSON parsing benchmark][json-bench] (running on my MacBook Pro 16" 2019 with `Intel i9-9880H @ 2.30GHz` and `Node@16.13`).

```hs
Running "JSON :: sigma vs parjs" suite...

sigma: 582 ops/s, ±1.12% | fastest
parjs: 138 ops/s, ±1.38% | slowest, 76.29% slower
sigma: 762 ops/s, ±0.82% | fastest
parjs: 134 ops/s, ±0.63% | slowest, 82.41% slower
```

I have included results from [Sigma] and [Parjs] (another parser combinator library). I wanted to also add [Arcsecond], because I like its API with functional flavor, but somehow their JSON example is _atrociously_ slow (like, orders of magnitude, 250-500 times slower).

The [JSON sample][json-sample] being parsed is a typical JSON data, which has 923 lines. This translates to ~530k lines of JSON per second, and that is actually on par with some Rust parser combinator crates like [pom].
The [JSON sample][json-sample] being parsed is a typical JSON data, which has 923 lines. This translates to **~700k** lines of JSON per second, and that is actually on par with some Rust parser combinator crates like [pom].

<!-- Links. -->

Expand Down
Loading

1 comment on commit 11d42b4

@vercel
Copy link

@vercel vercel bot commented on 11d42b4 May 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.