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

json: Add benchmark (+ fix existing benchmarks) #584

Merged
merged 5 commits into from
Dec 23, 2019
Merged

Conversation

ibgreen
Copy link
Collaborator

@ibgreen ibgreen commented Dec 22, 2019

Adds benchmarks for JSON, comparing to JSON.parse. Also adds an (unfortunately unfavorable) comparison to d3-csv for the CSVLoader

CSV Decode
├─ CSVLoader#parse: 279 iterations/s ±3.77%
├─ d3-dsv#parse: 2.13K iterations/s ±2.57%

Clarinet - JSON parsing from string
├─ JSON.parse (used by parseSync): 26.6K iterations/s ±3.55%
├─ ClarinetParser (used by parseInBatches): 7.15K iterations/s ±1.64%

JSONLoader - loading from file
├─ load(JSONLoader) - Uses JSON.parse: 717 iterations/s ±6.61%
├─ loadInBatches(JSONLoader) - Uses Clarinet: 204 iterations/s ±19.31%

@coveralls
Copy link

coveralls commented Dec 22, 2019

Coverage Status

Coverage increased (+3.4%) to 53.63% when pulling 286692e on ib/json-bench into 140fd02 on master.

// yield Promise.resolve(element);
// }
// }
async function* asyncIterator(array) {

Choose a reason for hiding this comment

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

why do we need this generators here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This benchmark compares the speed of non-async iteration with async iteration.

Async iteration is significantly slower.

@ibgreen ibgreen merged commit de2df88 into master Dec 23, 2019
@ibgreen ibgreen deleted the ib/json-bench branch December 23, 2019 23:07
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.

3 participants