generated from norskeld/serpent
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a couple of real-world-ish benchmarks with Sigma and Parjs: - JSON parser. - Tuple parser.
- Loading branch information
Showing
16 changed files
with
2,338 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Benchmarks | ||
|
||
Here you will find some benchmarks and rough performance comparison with similar libraries. | ||
|
||
## Notes | ||
|
||
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`). | ||
|
||
```hs | ||
Running "JSON :: sigma vs parjs" suite... | ||
|
||
sigma: 582 ops/s, ±1.12% | fastest | ||
parjs: 138 ops/s, ±1.38% | slowest, 76.29% 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]. | ||
|
||
<!-- Links. --> | ||
|
||
[json-bench]: ./src/json | ||
[json-sample]: ./src/json/@sample.ts | ||
[sigma]: https://github.com/norskeld/sigma | ||
[parjs]: https://github.com/GregRos/parjs | ||
[arcsecond]: https://github.com/francisrstokes/arcsecond | ||
[pom]: https://github.com/J-F-Liu/pom |
Oops, something went wrong.