Kijewski / Kijewski/pyjson5

Showing benchmarks in README ?

Open Beginner friendly
#149 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Cython
Stars
179
Forks
16
PR merge metrics
No merged PRs in 30d

Description

Hi, I came across pyjson5 mainly because the [json5](https://pypi.org/project/json5) project was very clear that it is slow.

My initial reaction was pyjson5 would be even slower because that's normally how libraries starting with py are :D (For example: pysqlite vs sqlite)
But when I saw this was actually written in cython, I was interested to know if it is faster than `json5`.

My very small microbenchmark shows:
```
# Large file: 2000x faster 🚀
In [4]: %timeit json5.loads(pathlib.Path('test_400kb.txt').read_text())
9.33 s ± 696 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

In [5]: %timeit pyjson5.loads(pathlib.Path('test_400kb.txt').read_text())
4.38 ms ± 206 μs per loop (mean ± std. dev. of 7 runs, 100 loops each)

# Small file: 1300x faster 🚀
In [6]: %timeit json5.loads(pathlib.Path('test_20kb.txt').read_text())
174 ms ± 9.42 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)

In [7]: %timeit pyjson5.loads(pathlib.Path('test_20kb.txt').read_text())
126 μs ± 7.3 μs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)
```

And that was a really amazing speed up.

I think it might be a good idea to highlight that in the README with some good benchmarks. For example: https://github.com/spyoungtech/json-five-rs#benchmarking

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the README and the benchmark example linked in the issue. Reproduce the json5 and pyjson5 loads comparisons using test_400kb.txt and test_20kb.txt, then document a clear benchmark summary and methodology in the README; done when readers can see the performance comparison and how it was measured.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation, performance
Issue type
Documentation
Difficulty
2/5
Estimated time
Half a day
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.