Skip to content

Showing benchmarks in README ? #149

Description

@AbdealiLoKo

Hi, I came across pyjson5 mainly because the 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions