• Lucid Dreaming - Dream Views




    Results 1 to 7 of 7
    1. #1
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935

      Would you QA my JSON library? C++

      Last time when I posted my math library here I got some really good feedback, so I'll do it again.

      Absolutely everything that my company does is done in JSON. My main project has 3 JSON parsers for various things (don't ask why I used 3 of them, speed reasons.) I wanted to unify everything in my cleanup, so I wrote a JIT JSON library, which is far faster than anything else I've used. But since I use JSON so much, I'd like to have more than just myself QA it. It would be nice if you could try my library from source code, I put methods in main.cpp for loading text files and testing from a string to make it easier

      Let me know if you find a way to make it crash or behave incorrectly. Or if you have comments about my code.

      Hey, I can hear Replicon yelling at me through the computer. I know what you're saying, but I have to use opaque pointers because the library will be used in every language from C, to Visual Basic, to Fortran

      If you wanna do a speed test with a huge JSON file, that'd be cool, but JSON_Parse doesn't parse everything at once, it's JIT, so doing a JSON_Write will cause the entire thing to get parse

      *If loading a file, white space is ignored, it's a bug in the file loader, not the JSON engine.



      EDIT: Just uploaded a new one, this one has an option to format the output
      Attached Files
      Last edited by ninja9578; 12-06-2009 at 06:04 PM.

    2. #2
      Member Achievements:
      1 year registered Veteran First Class 5000 Hall Points

      Join Date
      Sep 2004
      Gender
      Location
      Seattle, WA
      Posts
      2,503
      Likes
      217
      Quote Originally Posted by ninja9578 View Post
      Hey, I can hear Replicon yelling at me through the computer. I know what you're saying, but I have to use opaque pointers because the library will be used in every language from C, to Visual Basic, to Fortran
      LOL I'm flattered

      I haven't looked at this yet, but I was thinking I might inquire as to why you needed to re-invent the wheel (there has GOT to be a solid, commonly-used, open source JSON C++ library out there by now, which you might have contributed to with whatever was missing).

    3. #3
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      Actually, there are scores of JSON libraries: http://www.json.org/

      But they are insanely slow. Why is it that all of my XML parsers go 3x faster than any JSON libraries, even though JSON is a simpler syntax? The one I wrote ran circles around all of the other ones. Plus they were bloated and has features that I'm sure no one has ever used. And since I release an upgrade every day, I'd like my upgrades to be as small as possible.

      Secondly, we have an object oriented database and the servers return objects as JSON. I usually only need to use about 20% of the JSON that comes back, so I wanted an on-the-fly parser, which didn't seem to exist.
      Last edited by ninja9578; 12-07-2009 at 12:36 AM.

    4. #4
      Member Achievements:
      1 year registered Veteran First Class 5000 Hall Points

      Join Date
      Sep 2004
      Gender
      Location
      Seattle, WA
      Posts
      2,503
      Likes
      217
      Ooo on the fly is pretty neat. I just hope you're performance-optimizing in the right place

    5. #5
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      That's why I've posted it I think it's pretty well optimized, it seems really fast to me

      I also hated that all of the other parsers that I looked at spent a lot of time verifying the JSON (in order to verify, you gotta parse the whole thing,) and my company servers either return valid json or a 404.
      Last edited by ninja9578; 12-07-2009 at 12:56 AM.

    6. #6
      Member Achievements:
      1 year registered Veteran First Class 5000 Hall Points

      Join Date
      Sep 2004
      Gender
      Location
      Seattle, WA
      Posts
      2,503
      Likes
      217
      Quote Originally Posted by ninja9578 View Post
      That's why I've posted it I think it's pretty well optimized, it seems really fast to me
      I meant, on the greater scheme of things, I hope writing this super-fast JSON parser was the right place to optimize your overall app/platform.

    7. #7
      Banned
      Join Date
      Apr 2007
      Location
      Out Chasing Rabbits
      Posts
      15,193
      Likes
      935
      Seeing that the main file it loads is JSON (usually, sometimes XML uhg) and makes 20-1000 web requests per session, all returning JSON; I think it's pretty good for overall optimization

    Bookmarks

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •