Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use rapidjson as a JSON library #141

Closed
syoyo opened this issue Feb 9, 2019 · 7 comments
Closed

Use rapidjson as a JSON library #141

syoyo opened this issue Feb 9, 2019 · 7 comments

Comments

@syoyo
Copy link
Owner

syoyo commented Feb 9, 2019

Currently TinyGLTF uses nlohmann's json.hpp https://github.com/nlohmann/json as an underlying JSON library.

json.hpp is working well, but is overkill for TinyGLTF and sometimes it faces the portability problem related to C++ compiler versions.

https://github.com/dropbox/json11 is much more simple, portable, and has enough feature for TinyGLTF. I have implemented json11 version of TinyGLTF in json11 branch: https://github.com/syoyo/tinygltf/tree/json11

I am planning to switch to use json11 after running several tests.

@meshula
Copy link

meshula commented Feb 10, 2019

You might want to check timings. nlohmann json is not that fast, but it's faster than dropbox/json11...

https://github.com/miloyip/nativejson-benchmark

I'm personally using rapidjson, but YMMV of course.

@syoyo
Copy link
Owner Author

syoyo commented Feb 10, 2019

I'm personally using rapidjson, but YMMV of course.

You can contribute rapidjson version of TinyGLTF. PR is always welcome!
(Selecting JSON library by ifdef would be nice)

@vinjn
Copy link

vinjn commented Feb 15, 2019

Love this change - json.hpp is too huge

@Ybalrid
Copy link
Contributor

Ybalrid commented Feb 15, 2019

I tend to agree about RapidJSON being a great choice

@syoyo
Copy link
Owner Author

syoyo commented Jun 10, 2019

I have revisiting rapidjson and found there is a script which can generate single file of rapidjson headers.

Tencent/rapidjson#863

I have wrote rapidjson-amalgamation version of tinygltf(W.I.P.) and it works well so far.

https://github.com/syoyo/tinygltf/tree/rapidjson

It looks promising so I am planning to switch to use rapidjson for faster C++ compilation and builtin support of schema validator.

@syoyo syoyo changed the title Use drobbox/json11 as a JSON library Use rapidjson as a JSON library Aug 5, 2019
@Selmar
Copy link
Contributor

Selmar commented Aug 13, 2019

This will be great for us as well, as we are currently struggling with the # of allocations. Schema validation is an awesome plus! 👍

@syoyo
Copy link
Owner Author

syoyo commented Oct 30, 2019

We can now use RapidJSON in master branch by defining TINYGLTF_USE_RAPIDJSON and set include path to RapidJSON.

@syoyo syoyo closed this as completed Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants