-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Possible to speed up json::parse? #398
Comments
Can you provide the concrete example? |
Oh wow SUPER fast reply thank you sir! I currently do it like this:
|
Thanks, I shall have a look. |
So
What kind of hint were you thinking to send that would help parse that 1MB string faster? |
I generated a file that fits your description, see issue398.json.zip. Then I ran a benchmark (using https://nonius.io) parsing this file. Here is the output:
The mean parsing time is 38.96 milliseconds. I have no idea why parsing takes 4.5 seconds in your case. How does your input file look like? How does your parsing code look like? What compiler flags are you using? |
Thanks very very much for willing to discuss this with me, as it looks like it's a personal issue on my end! I am new to wirting C++. I am using Visual Studio 2015. Here is image of my code - http://i.imgur.com/OCmdZOC.png (side note: i dont know why it underlines json::parse, but it doesnt prevent compiling - on hover it shows this message - http://i.imgur.com/OhSYpnr.png ) My compile flags I'm not sure, but I looked up how to see compile configuration on the net and it led me to this dialog box - http://i.imgur.com/FXv82EJ.png Sincerest thanks! |
@gregmarr yep that's correct it looks like that. I'm not sure, what hint to give I was just trying my luck to ask haha. |
@Noitidart can you try compiling as release rather than debug |
Thanks @whackashoe testing right now! :) |
Debug Visual Studio STL is SIGNIFICANTLY slower than release due to all the extra checking that happens. |
Oh wow! You were right it is now 49ms if I do it with "Release". My sincerest thanks @nlohmann, @whackashoe, and @gregmarr!!! |
Glad it worked! Have a good one. |
Hi folks, you guys were really helpful thank you! I have been working with json.hpp for about a month now and have some questions. Is there a place I can post this? I searched the issues and didn't find similar. I don't want to clog up the issues forum, I'm not sure if it's ok with you all. Is there somewhere you can recommend I can ask questions please? |
@Noitidart Just open a new issue and ask. :) |
You are too too fast haha thank you very much for being so friendly all of you to new comers! |
Is there a workaround for this? , i'm loading ~100mb of JSON and it takes about 2-3 minutes to parse in debug mode. |
How fast is it in release mode? |
In release mode is as expected, very fast, but my main concern is debug mode, as the json data my program parses is big and can't be reduced very easily. |
Is it possible for me to give a hint to json::parse so it is faster?
I am receiving a JSON string from stdin. It contains a 1024kb string. Is there any tricks to make parse faster? Right now it takes 4.5 seconds.
Thanks
The text was updated successfully, but these errors were encountered: