Re: [Development] Json support for QtCore
On Sun, Dec 11, 2011 at 6:40 PM, Robin Burchell robin...@viroteck.net wrote: You're missing the bit where the binary format is not the only representation. JSON can be parsed into it, it's stored like this in memory, and it can be serialised back to it (obviously), but it can also be serialised back to JSON. Or QVariant. Right, and after re-reading over the thread I realized the binary representation of this specific implementation is just there for sake of slimness, performance and lightweight exchange. Attaining to my desire to store large bin chunks in JSON, this means that as the parser conforms with JSON, it'd store the chunks as base64 encoded strings? I would love to see something that, given the binary representation that's already mmap'able, stores the chunks data (streaming media files,audio, pdfs etc.) in place in its original binary form, and load each chunk (as is, binary form, no conversions indeed, super fast) on demand as it is accessed off the JSON model. -Sivan ___ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development
Re: [Development] Json support for QtCore
On Sun, Dec 11, 2011 at 8:31 AM, Robin Burchell robin...@viroteck.netwrote: hi, On Sat, Dec 10, 2011 at 10:32 PM, lars.kn...@nokia.com wrote: I've benchmarked parsing speed and compared to the qjson (http://qjson.sourceforge.net/). It's around 7 times faster for the test.json file included in the project (the test case used in qjson as well). I'd be interested to see how your parser fares compared to girish's work (existing benchmark results, somewhat outdated probably, found at http://git.forwardbias.in/?p=qjsonparser.git;a=commit;h=180f3a1ea85adbea4d77e50ff3be3e75af918252 ) - those results at least look a lot better than 7 times faster, but they are also probably different test data. But, parser aside: in general terms, I do think I agree that converting to/from QVariant as an API isn' all that nice, so your approach is a nice alternative. I do think I'd like to see QDataStream operators on QJsonDocument, btw. sending json documents in binary form to/from files or sockets would be useful. ___ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development A side chat about the stream operation. I have made a tiny project / class to help to convert a non-QObject based class to QVariantMap , and vice versa easily . So that it could be converted to JSON/XML/YAML by just taking a further step. http://www.qtcentre.org/threads/46315-QtMapStream-serialization-of-object-class-to-QVariantMap ___ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development
Re: [Development] Json support for QtCore
Op 11-12-2011 15:55, lars.kn...@nokia.com schreef: The binary representation is optimized for fast reading. The binary format is relatively compact and stores the whole object in one blob. Is this a standard binary format of JSON, or something of your own devise? It's something I wrote. I wanted it to be something that you can simply mmap from a file and use without ever having to parse anything to make saving and restoring of json objects as cheap as possible. The problem with bson is that it's a streaming format that still requires parsing and as such was unsuitable for some of the use cases I have. I think I am missing something here. What is the use of this? I mean, if it is not JSON, then it is just some random binary format, right? How does that help with parsing and providing JSON when you are communicating with a webservice, for instance? I mean, it is cool to have a file format that is able to contain a lot of standard stuff and be quick about it, but I don't really see the connection with JSON, and calling it a binary format of JSON is confusing to me. However, like I said, I guess I am missing something here. Could you explain what the relationship is between this binary format and the JSON format, and how it helps parsing creating JSON? André ___ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development
Re: [Development] Json support for QtCore
On Sun, Dec 11, 2011 at 5:33 PM, Andre Somers an...@familiesomers.nl wrote: However, like I said, I guess I am missing something here. Could you explain what the relationship is between this binary format and the JSON format, and how it helps parsing creating JSON? You're missing the bit where the binary format is not the only representation. JSON can be parsed into it, it's stored like this in memory, and it can be serialised back to it (obviously), but it can also be serialised back to JSON. Or QVariant. ___ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development
Re: [Development] Json support for QtCore
hi, On Sat, Dec 10, 2011 at 10:32 PM, lars.kn...@nokia.com wrote: I've benchmarked parsing speed and compared to the qjson (http://qjson.sourceforge.net/). It's around 7 times faster for the test.json file included in the project (the test case used in qjson as well). I'd be interested to see how your parser fares compared to girish's work (existing benchmark results, somewhat outdated probably, found at http://git.forwardbias.in/?p=qjsonparser.git;a=commit;h=180f3a1ea85adbea4d77e50ff3be3e75af918252) - those results at least look a lot better than 7 times faster, but they are also probably different test data. But, parser aside: in general terms, I do think I agree that converting to/from QVariant as an API isn' all that nice, so your approach is a nice alternative. I do think I'd like to see QDataStream operators on QJsonDocument, btw. sending json documents in binary form to/from files or sockets would be useful. ___ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development