-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
add patch_inplace function #3581
Conversation
A couple of things:
(Separately, we should address the quite frequent failure of MinGW in CI. Can we rehost the MinGW package without violating the license?) |
604ea2d
to
1e2556f
Compare
@falbrechtskirchinger thanks for the notes. What do you think about keeping docs in a single document? Otherwise there would be quite some duplication. This really drastically improves the performance for our use case as copying and destroying a 100Mb json file is really slow (on the tune of ~1 second per patch, vs a couple nanoseconds without the copy). I wonder if the destruction could be optimized in #3583 |
@wolfv I don't think there's precedent for similarly named functions being documented in one file and while I agree with you about the duplication, @nlohmann will probably want a dedicated You're at least missing an entry in - 'patch_inplace': api/basic_json/patch.md Also, can you please prepare the examples in // output original document
std::cout << std::setw(4) << doc << "\n\n";
// apply the patch in-place
doc.patch_inplace(patch);
// output patched document
std::court << std::setw(4) << doc << std::endl; Did you run |
Thanks for the review! I applied your suggestions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Note to me:
|
@nlohmann thanks for approving! Is the remaining task something I should do? |
Thanks for your work!
It's basically checking that the new Markdown file is added to docs/mkdocs/docs/api/basic_json/index.md, docs/mkdocs/mkdocs.yml, and docs/docset/docSet.sql. I'll take care of it. |
I am trying to
patch
a >100Mb JSON file and it turns out that the copying / destruction of JSON objects takes quite long.Not allocating a new JSON for each patch helps a lot in terms of speed (>100x improvement).
Pull request checklist
Read the Contribution Guidelines for detailed information.
include/nlohmann
directory, runmake amalgamate
to create the single-header filesingle_include/nlohmann/json.hpp
. The whole process is described here.Please don't
#ifdef
s or other means.