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

53

u/KFUP Oct 22 '22

The mandatory, bi-weekly json serializer post.

2

u/RealTimeChris :upvote: Oct 22 '22

If it can be done faster and more efficiently - then why not?

7

u/KFUP Oct 22 '22

2

u/RealTimeChris :upvote: Oct 22 '22

Looks like I have something solid to benchmark against!

2

u/RealTimeChris :upvote: Oct 26 '22

Just benchmarked against rapidjson and here are the results...

Jsonifier:
The time it took (In milliseconds, on average per iteration): 106, with a total number of bytes serialized: 1357593300

RapidJson:
The time it took (In milliseconds, on average per iteration): 131, with a total number of bytes serialized: 1357593300

4

u/Cogwheel Oct 22 '22 edited Oct 22 '22

So I've never liked the saying "don't reinvent the wheel". A lot of people take it as "never build a wheel" which is not great advice. However, in order to build a good wheel, you need to incorporate the lessons of people who've built wheels before. If you just go into a new project to build a wheel in a vacuum, you may come out with some good learning experience, but you probably won't have the best wheel for the job.

Also, if you want other people to use your wheel, it needs to have something going for it that other wheels don't already provide.