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

Change json_pointer to provide an iterator begin/end/etc, don't use vectors, and also enable string_view #1312

Closed
timprepscius opened this issue Oct 22, 2018 · 2 comments
Labels
state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated state: waiting for PR

Comments

@timprepscius
Copy link

I'm doing almost all interactions with my json trees via json_pointer.
The json pointer's vector is a performance bottle neck.

In my view, json_pointer should have the pointer_type be defined in the template specialization.
(so that I can easily turn on string_view)

And it should never split the strings into a vector, but rather allow for iteration, do on-the-fly-unescaping as needed.

In my my case, the speed up is quite considerable.

Also, this goes hand in hand with moving the object_t key_type to a separate template parameter.
(so that I can easily turn on string_view in the basic_json as well)

Will post a PR prob thurs/fri. Will just make a new json_pointer class and if def, instead of making changes, might be useful to test one against the other.

@nlohmann
Copy link
Owner

Thanks for proposing an improvement!

I am really interested to see an example where the overhead of the current string/vector approach is measurable! It would be great to have this as a benchmark.

I would really look forward to a PR - just one remark: the library targets C++11, so an approach using std::string_view is not suitable, I'm afraid.

@stale
Copy link

stale bot commented Nov 24, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Nov 24, 2018
@stale stale bot closed this as completed Dec 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated state: waiting for PR
Projects
None yet
Development

No branches or pull requests

2 participants