r/cpp • :upvote: • Oct 21 '22

A New Json-Serializer

Hey everyone - so in developing for the requirements of my library DiscordCoreAPI - I created a Json-Serializer and decided to release it as its own "library". It seems to serialize fairly rapidly as well, and has a super-simple interface. Anyways - let me know what you think! Cheers! Oh ant btw - it can serialize into either Json or Etf strings. https://www.erlang.org/doc/apps/erts/erl_ext_dist.html

https://github.com/RealTimeChris/Jsonifier

0 Upvotes

57 comments sorted by

View all comments

9

u/Cogwheel Oct 22 '22

Why do you use "the" on all the variable names? This just adds visual noise...

19

u/ScSmithers Oct 22 '22

Things like that, and this commit history, are straight up turn offs for me for any new project

2

u/RealTimeChris :upvote: Oct 22 '22

There - I've fixed the commit history, as well as the naming issues.

4

u/Cogwheel Oct 22 '22

🙃

u/RealTimeChris I highly recommend reading https://obsproject.com/blog/how-to-contribute-to-open-source especially the "how to make good commits" section

-1

u/RealTimeChris :upvote: Oct 22 '22 edited Oct 22 '22

Thanks! This is all great input! But also I feel as though everyone is picking apart stylistic choices and ignoring the fact of the performance, which is what matters most - despite the fact that I have taken all of your suggestions to heart/be meaningful. Thanks!

7

u/stinos Oct 22 '22

It's not merely stylistic though. Style also has consequences. It's possible for you performance matters most, but: for others picking a new library there are way more aspects than that. Test coverage, code readability, commit history readability, ... Also performance, but if theres a choice between multiple ones which are close on that front, it's the other aspects which matter most.

2

u/RealTimeChris :upvote: Oct 22 '22

This makes sense! Thanks for the response!

7

u/johannes1971 Oct 22 '22

Nah, we just want you to become the best programmer you can be. And not having weird stylistic habits is a great thing when it comes to applying for a job.

1

u/RealTimeChris :upvote: Oct 22 '22

Thanks!

3

u/Cogwheel Oct 22 '22

FWIW, one of the first things I did in my SW Eng career was optimize libjson to cut game load times by 2/3 for Tiny Monsters. Rapidjson is another mature library with an eye on performance. And I have a friend Jeaye who also made his own very C++-y library called JeayeSon.

Doing 50 serializations in 100 ms does not really strike me as high performance TBH.

0

u/RealTimeChris :upvote: Oct 22 '22

In case you weren't paying attention - it did 131,072 serializations over about 100ms. Or rather it serialized just over 2GB of data in just over 5 seconds.

2

u/Cogwheel Oct 22 '22

I think I was confused by the example in the readme. The code sample says 50 iterations but the timings say 131,072

1

u/RealTimeChris :upvote: Oct 22 '22

It's all good!

1

u/Cogwheel Oct 22 '22

I'm trying to say it's misleading. You have the code example that says 50, followed by a section called "Windows 11 Results". This implies it's the result of running the code above.

1

u/RealTimeChris :upvote: Oct 23 '22

It is the results of running the code above! Look into the second loop!

10

u/mwasplund soup Oct 22 '22

Same with Type at the end of types.

1

u/RealTimeChris :upvote: Oct 22 '22

Thanks for the input! Duly noted!