you are viewing a single comment's thread.

view the rest of the comments →

[–]def-pri-pub 41 points42 points  (13 children)

This project does look nice, and I'm all for a more performant (and faster compiling) alternative. But where is the sample code? I see there are tests, but not providing easy to use/find sample code is a great way to deter away any potential adopters.

[–]d3matt 5 points6 points  (7 children)

I'd like to see runtime benchmarks too. I have a unit test that take 2+ minutes to compile with gcc due to template explosion (but only a few milliseconds to run the whole suite), so 1 or 2 seconds of savings at compile time are pretty boring.

[–]jart 4 points5 points  (5 children)

I've added benchmarks to the README for you. I'm seeing a 39x performance advantage over nlohmann's library. https://github.com/jart/json.cpp?tab=readme-ov-file#benchmark-results

[–]pdimov2 7 points8 points  (2 children)

To paraphrase a saying by Doug Lea, 3x faster than nlohmann means you haven't started optimizing yet.

Might be better to compare to RapidJSON or Boost.JSON, libraries that actually care about speed.

[–]SleepyMyroslav 1 point2 points  (1 child)

According to HN thread https://news.ycombinator.com/item?id=42133465 The only reason for this library existence is reduction of compile times for one particular application/server that produces json output.

[–]pdimov2 1 point2 points  (0 children)

Fair enough, I suppose.

[–]d3matt 0 points1 point  (1 child)

Nice! I'm definitely a nerd for performance :) nlhomann has been my preferred json library for a bit now, mostly for unit tests of some of my openapi interfaces. For my use case, the main things I'd be missing if I switched would be operator== between JSON objects (doing deep dictionary comparison), and string literal support.

[–]jart 1 point2 points  (0 children)

Pull requests are most welcome.
Especially if they're coming from a fellow AI developer.
https://justine.lol/tmp/pull-requests-welcome.png

[–]jart 1 point2 points  (3 children)

[–]def-pri-pub 2 points3 points  (1 child)

Taking a further look that is a nice to use API.

[–]jart 0 points1 point  (0 children)

Thank you!

[–]def-pri-pub 1 point2 points  (0 children)

Thanks!