Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add benchmarks for issue #39 #43

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

felix9
Copy link
Contributor

@felix9 felix9 commented Sep 2, 2017

I decided to systematically benchmark various parsers on equivalent input.
Here are some results, running on my laptop.

Empty or almost-empty file. json is the native JSON.parse, and it will almost always win. It's basically an upper bound on performance.

parse empty with ini           x 3,117,553 ops/sec ±0.83% (81 runs sampled)
parse empty with js-yaml       x 2,873,395 ops/sec ±1.33% (89 runs sampled)
parse empty with js-yaml(json) x 2,877,457 ops/sec ±0.91% (90 runs sampled)
parse empty with json          x 3,471,484 ops/sec ±0.95% (89 runs sampled)
parse empty with toml-j0.4     x 111,698 ops/sec ±0.84% (91 runs sampled)
parse empty with toml-node     x 140,756 ops/sec ±1.96% (89 runs sampled)
parse empty with yaml          x 580,454 ops/sec ±0.58% (91 runs sampled)
parse empty with yamljs        x 558,640 ops/sec ±0.90% (89 runs sampled)

Small hello-world file.

parse hello with ini           x 218,876 ops/sec ±1.03% (89 runs sampled)
parse hello with js-yaml       x 421,704 ops/sec ±1.10% (88 runs sampled)
parse hello with js-yaml(json) x 499,956 ops/sec ±0.80% (86 runs sampled)
parse hello with json          x 1,407,042 ops/sec ±0.83% (90 runs sampled)
parse hello with toml-j0.4     x 61,319 ops/sec ±0.82% (87 runs sampled)
parse hello with toml-node     x 34,552 ops/sec ±2.11% (87 runs sampled)
parse hello with yaml          x 171,860 ops/sec ±0.85% (94 runs sampled)
parse hello with yamljs        x 87,918 ops/sec ±1.31% (86 runs sampled)

Real cargo.toml from the Rust Cargo project (with minor changes).

parse cargo with js-yaml       x 9,848 ops/sec ±2.25% (85 runs sampled)
parse cargo with js-yaml(json) x 12,445 ops/sec ±0.90% (91 runs sampled)
parse cargo with json          x 64,939 ops/sec ±0.80% (88 runs sampled)
parse cargo with toml-j0.4     x 2,833 ops/sec ±1.87% (84 runs sampled)
parse cargo with toml-node     x 170 ops/sec ±1.07% (80 runs sampled)
parse cargo with yamljs        x 1,673 ops/sec ±4.90% (85 runs sampled)

toml-node is noticeably slower, and for cargo.toml most of the cost seems to be in the parser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant