Optimising JSON parsing leads to wierd execution timings

Seb via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Mar 27 02:05:00 PDT 2017


On Saturday, 25 March 2017 at 06:53:58 UTC, xtreak wrote:
> Hi,
>
> Sorry for the double post. I have asked a question at 
> Stackoverflow regarding this : 
> https://stackoverflow.com/questions/42992507/get-float-value-out-of-jsonvalue-in-dlang . I have a `rating` field that might have 3 which parses to JSONValue.integer or 3.4 which parses to JSONValue.floating and I need to use float. I was using exceptions that was causing the program to be slow as per the profile information. Now I have used an if clause as suggested by Adam in the answer. Though the execution time for the relevant function that used exceptions earlier reduced the program was still taking the same time.
>
> [...]

If you need a fast JSON library, have a look at 
https://github.com/tamediadigital/asdf or 
https://github.com/s-ludwig/std_data_json


More information about the Digitalmars-d-learn mailing list