digitalmars.D - Wanted: Review manager for std.data.json
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (7/7) Apr 07 2015 Anyone up to this? The issues of the previous discussion [1] have all
- tcha (46/53) Apr 07 2015 Out of curiosity I tried to use this lib in lately discussed
- Iain Buclaw via Digitalmars-d (11/27) Apr 08 2015 been addressed now more or less, so the package is ready for a more
- Martin Nowak (2/6) Apr 08 2015 Have you tried to use the pull/stream parser?
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (6/25) Apr 08 2015 DUB uses the path of the compiler binary, as well as the reported
- tcha (4/8) Apr 08 2015 I tried it with dub clean, dub --force, even removed
- Iain Buclaw via Digitalmars-d (5/14) Apr 08 2015 I find these undefined references frankly bizarre (undefined
- Dicebot (2/9) Apr 07 2015 If no one else steps up, I can do it after DConf.
- Andrei Alexandrescu (4/16) Apr 08 2015 Thanks. I think it would be great if we moved faster with this - any
- Andrea Fontana (3/10) Apr 08 2015 Any plan to support functions like these?
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (8/10) Apr 08 2015 There is opt() [1], which takes a path and returns a
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (18/29) Jul 28 2015 This seems a bit awkward to use. For example, it cannot handle
- Robert burner Schadek (3/3) Apr 08 2015 IMO this should be a PR for phobos so all comments to the code
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (7/10) Apr 08 2015 That's what we have the review thread for. The library is now in a state...
- Robert burner Schadek (6/13) Apr 08 2015 from experience: Hardly anybody reads previous posts. comments on
- Martin Nowak (4/7) Apr 08 2015 I made a note, will see if I time to help with that. Algebraic
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (4/9) Apr 08 2015 The problem is that even the pull parser alone is relatively slow. Also,...
- tcha (30/33) Apr 08 2015 Unfortunatelly I overlooked that I tested it with std_data_json v
- Iain Buclaw via Digitalmars-d (5/38) Apr 08 2015 Frankly, if we are not as fast (or elegant) as Python's json library,
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (16/28) Apr 09 2015 I've filed two tickets for linker errors (and added a workaround for the...
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (3/20) Apr 09 2015 Actually it seems to be the first issue (14425). I've already added a
- Martin Nowak (10/17) Apr 09 2015 I didn't found too many issues.
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (6/23) Apr 09 2015 I'll have a look at the DOM part later. At the moment I'm looking at low...
- w0rp (12/16) Apr 16 2015 I'll leave the speed aside, as more recent posts show
- Martin Nowak (10/16) Apr 09 2015 8.53s, 1786.8Mb
- John Colvin (2/20) Apr 09 2015 Still getting trounced across the board by rapidjson.
- Martin Nowak (2/4) Apr 09 2015 Yep, anyone knows why? They don't even use a lazy parser.
- "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= (2/6) Apr 09 2015 simd optimized scanning and format-optimized inlined conversion
- Andrei Alexandrescu (2/24) Apr 09 2015 Agreed. Rapidjson is the most important baseline. -- Andrei
- Iain Buclaw via Digitalmars-d (4/10) Apr 09 2015 Wasn't @nogc introduced in 2.066 ?
- weaselcat (13/31) Apr 09 2015 ldc -singleobj flag speeds it up dramatically
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (2/35) Apr 09 2015 Not sure, but that may also have been my recent optimizations.
- weaselcat (3/4) Apr 09 2015 Just tried it with your recent optimizations and it doesn't build
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (3/7) Apr 09 2015 Should work now. I just tested LDC with -singleobj and it's faster than
- weaselcat (4/14) Apr 09 2015 What flags are you using? RapidJSON is still a lot faster for me.
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (5/19) Apr 09 2015 I'll have to test with that exact version, because I've used my own
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (3/23) Apr 09 2015 One thing about the D benchmark is that it uses readText(). To be a fair...
- weaselcat (5/39) Apr 09 2015 I saw that commit to the benchmark and changed it locally.
- weaselcat (3/7) Apr 09 2015 Also, since an LDC dev might read this - is there a reason
- John Colvin (4/13) Apr 10 2015 I argued it should be the default a while ago and I vaguely
- David Nadlinger (9/15) Apr 10 2015 I still agree with you. ;)
- John Colvin (3/29) Apr 09 2015 I can't remember which -O level inlining is enabled, but there's
- weaselcat (3/5) Apr 09 2015 -enable-inlining(enabled at -O2) and -inline do different things
- weaselcat (6/11) Apr 09 2015 Sorry Sönke for polluting your thread, but I did some reading of
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (3/15) Apr 09 2015 Hm interesting, but for me LDC unfortunately crashes when adding
- weaselcat (10/32) Apr 09 2015 ldc2 -partial-inliner -boundscheck=off -singleobj
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (3/13) Apr 09 2015 Okay, turned out that this was a 0.15.2-beta.1 issue. I've downgraded to...
- y (28/28) Apr 09 2015 what a difference. cool stuff Sönke!
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (2/11) Apr 09 2015 Okay let's say about the same speed, the numbers fluctuate quite a bit.
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (5/37) Apr 09 2015 I got the latest version using the pull parser down to the Crystal Pull
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (10/10) Apr 09 2015 These are my results (a little bit flaky timings because it's a tablet
- Martin Nowak (13/18) Apr 09 2015 The review hasn't yet started and I'm already against the "stream"
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (8/26) Apr 09 2015 That would be a nice intermediate level parser. However, the range based...
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (2/18) Apr 09 2015 https://github.com/s-ludwig/benchmarks/blob/master/json/test_new_lazy.d
- Martin Nowak (2/4) Apr 09 2015 That was fast :).
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (3/10) Apr 08 2015 It seems the `in` operator (or an equivalent method) isn't
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (5/17) Apr 08 2015 I didn't try it, but the idea is that all operations on JSONValue are
- Jacob Carlborg (5/8) Apr 16 2015 Is it possible to use "toJSON" or a similar method to generate JSON from...
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (5/11) Apr 16 2015 I'd like to let that be part of a more general serialization framework
- Jacob Carlborg (12/16) Apr 16 2015 I was thinking about some low level primitives that a serialization
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (34/49) Apr 16 2015 Yes, just without setting the kind explicitly (it's set automatically by...
- w0rp (6/69) Apr 16 2015 I think serialiastion for this JSON library should probably be
- Jacob Carlborg (7/12) Apr 16 2015 I'm working on the general serialization API. I'm working on rewriting
- Jacob Carlborg (5/33) Apr 16 2015 That looks very handy, that would be great to have.
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (4/11) Jul 26 2015 So, since Dicebot has stepped down from his review manager role, is
- Atila Neves (4/21) Jul 27 2015 I can do it. It's just announcing and counting votes, right? Is
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (4/24) Jul 27 2015 That'd be great, thanks! I *think* that's all (maybe also updating the
- extrawurst (4/24) Jul 28 2015 I guess folks would be much more willing to do this if it was
- =?UTF-8?B?U8O2bmtlIEx1ZHdpZw==?= (3/11) Jul 28 2015 Just found something:
- Jacob Carlborg (4/6) Jul 28 2015 I would add "making sure the review queue is updated".
Anyone up to this? The issues of the previous discussion [1] have all been addressed now more or less, so the package is ready for a more thorough review. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ [1]: http://forum.dlang.org/thread/lt5s76$is$1 digitalmars.com#post-lt5s76:24is:241:40digitalmars.com
Apr 07 2015
On Tuesday, 7 April 2015 at 16:37:15 UTC, Sönke Ludwig wrote:Anyone up to this? The issues of the previous discussion [1] have all been addressed now more or less, so the package is ready for a more thorough review. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ [1]: http://forum.dlang.org/thread/lt5s76$is$1 digitalmars.com#post-lt5s76:24is:241:40digitalmars.comOut of curiosity I tried to use this lib in lately discussed benchmark [1] Original values on my machine (dmd 2.067, gdc 4.8.4, ldc2 0.15.1 llvm 3.5.1): D - 10.22s, 1322.7Mb D Gdc - 24.30s, 926.8Mb D Ldc - 25.93s, 925.8Mb With this lib it gets to [2]: D - 7.48s, 1794.0Mb Gdc and Ldc cannot build it with release (debug works) [3] and [4] I also tried it with vibe.d's json [5]: D - 44.77s, 2752.5Mb D Gdc - 163.79s, 936.5Mb D Ldc - 165.52s, 935.0Mb So it seems that the new lib is a way to go. As a newb to D I would like to know if there is a more elegant way to write: auto coordinates = jval.get!(JSONValue[string])["coordinates"].get!(JSONValue[]); and x += val.opt("x").coerce!double; I tried to fiddle with used JSONValue, Algebraic and VariantN things, but without success. It's also weird (and undocumented in examples how to use the JSONValue other than in asserts) that this works: JSONValue a = 12; assert(a == 12.0); and this is not: long b = a; I'd like if something like this can be possible: auto coords = parseJson(text)["coordinates"]; foreach (val; coordinates) { x += val["x"].get!double; y += cast(double)val["y"]; z += to!double(val["z"]); } Also is there some way to use this lib for serialization and deserialization of normal objects? To use it like: auto coords = parseJson(text)["coordinates"].map!(a=>cast(SomeStruct)a); [1] https://github.com/kostya/benchmarks/tree/master/json [2] http://pastebin.com/22xX6V0J [3] http://pastebin.com/WshDpnQD [4] http://pastebin.com/zj13Z7yG [5] http://pastebin.com/FLLXBCe1
Apr 07 2015
On 8 Apr 2015 00:05, "tcha via Digitalmars-d" <digitalmars-d puremagic.com> wrote:On Tuesday, 7 April 2015 at 16:37:15 UTC, S=C3=B6nke Ludwig wrote:been addressed now more or less, so the package is ready for a more thorough review.Anyone up to this? The issues of the previous discussion [1] have allhttp://forum.dlang.org/thread/lt5s76$is$1 digitalmars.com#post-lt5s76:24is:= 241:40digitalmars.comCode: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ [1]:Out of curiosity I tried to use this lib in lately discussed benchmark [1=]Original values on my machine (dmd 2.067, gdc 4.8.4, ldc2 0.15.1 llvm3.5.1):D - 10.22s, 1322.7Mb D Gdc - 24.30s, 926.8Mb D Ldc - 25.93s, 925.8Mb With this lib it gets to [2]: D - 7.48s, 1794.0Mb Gdc and Ldc cannot build it with release (debug works) [3] and [4]I assume you cleared your dub cache and didn't try linking a dmd built library to a gdc/ldc application. :) Iain.
Apr 08 2015
On Wednesday, 8 April 2015 at 07:14:32 UTC, Iain Buclaw wrote:Have you tried to use the pull/stream parser?With this lib it gets to [2]: D - 7.48s, 1794.0Mb Gdc and Ldc cannot build it with release (debug works) [3] and [4]
Apr 08 2015
Am 08.04.2015 um 09:14 schrieb Iain Buclaw via Digitalmars-d:On 8 Apr 2015 00:05, "tcha via Digitalmars-d" <digitalmars-d puremagic.com <mailto:digitalmars-d puremagic.com>> wrote: > > Out of curiosity I tried to use this lib in lately discussed benchmark [1] > > Original values on my machine (dmd 2.067, gdc 4.8.4, ldc2 0.15.1 llvm 3.5.1): > D - 10.22s, 1322.7Mb > D Gdc - 24.30s, 926.8Mb > D Ldc - 25.93s, 925.8Mb > > With this lib it gets to [2]: > D - 7.48s, 1794.0Mb > Gdc and Ldc cannot build it with release (debug works) [3] and [4] > I assume you cleared your dub cache and didn't try linking a dmd built library to a gdc/ldc application. :) Iain.DUB uses the path of the compiler binary, as well as the reported frontend version to distinguish builds of different compilers, so that clearing the cache shouldn't be necessary. But there are definitely performance issues. My own tests are far from what I would have expected, including for the pull parser...
Apr 08 2015
On Wednesday, 8 April 2015 at 07:14:32 UTC, Iain Buclaw wrote:I assume you cleared your dub cache and didn't try linking a dmd built library to a gdc/ldc application. :) Iain.I tried it with dub clean, dub --force, even removed std_data_json package to clone it again, but no success. Here is a full dub build -v output: http://pastebin.com/yHV3gYcX
Apr 08 2015
On 8 April 2015 at 12:39, tcha via Digitalmars-d <digitalmars-d puremagic.com> wrote:On Wednesday, 8 April 2015 at 07:14:32 UTC, Iain Buclaw wrote:I find these undefined references frankly bizarre (undefined reference to std.math.pow?) - can you reduce these with dustmite? Iain.I assume you cleared your dub cache and didn't try linking a dmd built library to a gdc/ldc application. :) Iain.I tried it with dub clean, dub --force, even removed std_data_json package to clone it again, but no success. Here is a full dub build -v output: http://pastebin.com/yHV3gYcX
Apr 08 2015
On Tuesday, 7 April 2015 at 16:37:15 UTC, Sönke Ludwig wrote:Anyone up to this? The issues of the previous discussion [1] have all been addressed now more or less, so the package is ready for a more thorough review. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ [1]: http://forum.dlang.org/thread/lt5s76$is$1 digitalmars.com#post-lt5s76:24is:241:40digitalmars.comIf no one else steps up, I can do it after DConf.
Apr 07 2015
On 4/7/15 5:43 PM, Dicebot wrote:On Tuesday, 7 April 2015 at 16:37:15 UTC, Sönke Ludwig wrote:Thanks. I think it would be great if we moved faster with this - any chance that you or someone else starts this before DConf such that we get to vote during DConf? That'd be pretty cool. -- AndreiAnyone up to this? The issues of the previous discussion [1] have all been addressed now more or less, so the package is ready for a more thorough review. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ [1]: http://forum.dlang.org/thread/lt5s76$is$1 digitalmars.com#post-lt5s76:24is:241:40digitalmars.comIf no one else steps up, I can do it after DConf.
Apr 08 2015
Any plan to support functions like these? http://forum.dlang.org/thread/lrknjl$co7$1 digitalmars.com?page=4#post-bcszdbasnjzmbwzdgeqy:40forum.dlang.org On Tuesday, 7 April 2015 at 16:37:15 UTC, Sönke Ludwig wrote:Anyone up to this? The issues of the previous discussion [1] have all been addressed now more or less, so the package is ready for a more thorough review. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ [1]: http://forum.dlang.org/thread/lt5s76$is$1 digitalmars.com#post-lt5s76:24is:241:40digitalmars.com
Apr 08 2015
Am 08.04.2015 um 10:24 schrieb Andrea Fontana:Any plan to support functions like these? http://forum.dlang.org/thread/lrknjl$co7$1 digitalmars.com?page=4#post-bcszdbasnjzmbwzdgeqy:40forum.dlang.orgThere is opt() [1], which takes a path and returns a `Nullable!JSONValue`. "get" is unfortunately already taken by std.typecons.Algebraic, so we can't use it for its AA meaning. Maybe another overload of opt? JSONValue opt(JSONValue default_value, string[] path...); [1]: http://s-ludwig.github.io/std_data_json/stdx/data/json/value/json_value.opt.html
Apr 08 2015
On Wednesday, 8 April 2015 at 10:02:30 UTC, Sönke Ludwig wrote:Am 08.04.2015 um 10:24 schrieb Andrea Fontana:This seems a bit awkward to use. For example, it cannot handle numeric indices. Could we instead have an `undefined` value, that evaluates to `false` in a boolean context, and otherwise behaves as if it were absent? The two `opIndex` overloads will again return `undefined` for this value, as well as for non-objects and non-arrays, and for non-existing elements. Then you could access JSON values in an intuitive way without worrying about getting Exceptions or even Errors: writeln(json[42]["abc"][10 .. 20].get!int); Only the `get` operation would throw if the type is wrong. This also allows for easy and unambiguous testing whether an object contains a key: if(json["bla"] == JSONValue.undefined) { writeln("not found"); } Anyway, it needs to be made clear what the behaviour on out-of-bounds or non-existing keys is: `undefined` value, exception, error?Any plan to support functions like these? http://forum.dlang.org/thread/lrknjl$co7$1 digitalmars.com?page=4#post-bcszdbasnjzmbwzdgeqy:40forum.dlang.orgThere is opt() [1], which takes a path and returns a `Nullable!JSONValue`. "get" is unfortunately already taken by std.typecons.Algebraic, so we can't use it for its AA meaning. Maybe another overload of opt? JSONValue opt(JSONValue default_value, string[] path...); [1]: http://s-ludwig.github.io/std_data_json/stdx/data/json/value/json_value.opt.html
Jul 28 2015
IMO this should be a PR for phobos so all comments to the code can be collected in one location. Where is the benchmark against std.json and rapidjson?
Apr 08 2015
Am 08.04.2015 um 11:05 schrieb Robert burner Schadek:IMO this should be a PR for phobos so all comments to the code can be collected in one location. Where is the benchmark against std.json and rapidjson?That's what we have the review thread for. The library is now in a state that everyone can easily try out. If it were a Phobos PR, that would be much more difficult (or I'd have to maintain two versions in parallel). I still have to look into running a proper benchmark. Initial numbers that I just collected have not been as good as expected - I'll have to take a closer look at the compiler output.
Apr 08 2015
On Wednesday, 8 April 2015 at 09:58:31 UTC, Sönke Ludwig wrote:That's what we have the review thread for. The library is now in a state that everyone can easily try out. If it were a Phobos PR, that would be much more difficult (or I'd have to maintain two versions in parallel).from experience: Hardly anybody reads previous posts. comments on the source make it easier for you to get useful criticism and filter all the noise.I still have to look into running a proper benchmark. Initial numbers that I just collected have not been as good as expected - I'll have to take a closer look at the compiler output.I thought more performance was one of the major reason for the json replacement. We need graphs!
Apr 08 2015
On Wednesday, 8 April 2015 at 09:58:31 UTC, Sönke Ludwig wrote:Initial numbers that I just collected have not been as good as expected. I'll have to take a closer look at the compiler output.I made a note, will see if I time to help with that. Algebraic might be a problem as it's based on typeinfo not tags, just a wild guess though.
Apr 08 2015
Am 08.04.2015 um 12:34 schrieb Martin Nowak:On Wednesday, 8 April 2015 at 09:58:31 UTC, Sönke Ludwig wrote:The problem is that even the pull parser alone is relatively slow. Also, for some reason the linker reports unresolved symbols as soon as I build without the -debug flag...Initial numbers that I just collected have not been as good as expected. I'll have to take a closer look at the compiler output.I made a note, will see if I time to help with that. Algebraic might be a problem as it's based on typeinfo not tags, just a wild guess though.
Apr 08 2015
On Wednesday, 8 April 2015 at 13:56:55 UTC, Sönke Ludwig wrote:The problem is that even the pull parser alone is relatively slow. Also, for some reason the linker reports unresolved symbols as soon as I build without the -debug flag...Unfortunatelly I overlooked that I tested it with std_data_json v 0.12.0 yesterday. So tested it again today on master: dmd and gdc failed to build in release ldc2 works I tried it also with ParseJSONStream and made fork from original benchmark with added tests (https://github.com/chalucha/benchmarks) so anyone can look (and PR) Some results: Ruby - 6.74s, 2106.2Mb Go - 5.92s, 420.9Mb D - 10.26s, 1322.5Mb D Gdc - 24.76s, 926.1Mb D Ldc - 26.31s, 925.0Mb D new - debug - 14.98s, 1782.0Mb D new Gdc - debug - 29.08s, 1663.9Mb D new Ldc - 16.99s, 1663.0Mb D new lazy - debug - 11.50s, 213.2Mb D new lazy Gdc - debug - 13.66s, 206.1Mb D new lazy Ldc - 3.59s, 205.4Mb Python - 5.89s, 1063.4Mb C++ Boost - 14.60s, 2884.8Mb C++ Rapid - 0.80s, 678.9Mb Also tried to dustmite the minimal failing version and here is a result: http://pastebin.com/YjdvT3G4 It's my first use of it so I hope it can help to solve this problem. It outputs less errors, but also compiles fine in debug and fails to link in release.
Apr 08 2015
On 8 April 2015 at 20:32, tcha via Digitalmars-d <digitalmars-d puremagic.com> wrote:On Wednesday, 8 April 2015 at 13:56:55 UTC, Sönke Ludwig wrote:Frankly, if we are not as fast (or elegant) as Python's json library, it should be thrown out back to the drawing board. Iain.The problem is that even the pull parser alone is relatively slow. Also, for some reason the linker reports unresolved symbols as soon as I build without the -debug flag...Unfortunatelly I overlooked that I tested it with std_data_json v 0.12.0 yesterday. So tested it again today on master: dmd and gdc failed to build in release ldc2 works I tried it also with ParseJSONStream and made fork from original benchmark with added tests (https://github.com/chalucha/benchmarks) so anyone can look (and PR) Some results: Ruby - 6.74s, 2106.2Mb Go - 5.92s, 420.9Mb D - 10.26s, 1322.5Mb D Gdc - 24.76s, 926.1Mb D Ldc - 26.31s, 925.0Mb D new - debug - 14.98s, 1782.0Mb D new Gdc - debug - 29.08s, 1663.9Mb D new Ldc - 16.99s, 1663.0Mb D new lazy - debug - 11.50s, 213.2Mb D new lazy Gdc - debug - 13.66s, 206.1Mb D new lazy Ldc - 3.59s, 205.4Mb Python - 5.89s, 1063.4Mb C++ Boost - 14.60s, 2884.8Mb C++ Rapid - 0.80s, 678.9Mb Also tried to dustmite the minimal failing version and here is a result: http://pastebin.com/YjdvT3G4 It's my first use of it so I hope it can help to solve this problem. It outputs less errors, but also compiles fine in debug and fails to link in release.
Apr 08 2015
Am 08.04.2015 um 20:55 schrieb Iain Buclaw via Digitalmars-d:On 8 April 2015 at 20:32, tcha via Digitalmars-d <digitalmars-d puremagic.com> wrote:I've filed two tickets for linker errors (and added a workaround for the first one): https://issues.dlang.org/show_bug.cgi?id=14425 https://issues.dlang.org/show_bug.cgi?id=14429 I'll try to reduce the pastebin reduced sample further, too, as it looks like it has yet another root cause.(...) Also tried to dustmite the minimal failing version and here is a result: http://pastebin.com/YjdvT3G4 It's my first use of it so I hope it can help to solve this problem. It outputs less errors, but also compiles fine in debug and fails to link in release.Frankly, if we are not as fast (or elegant) as Python's json library, it should be thrown out back to the drawing board. Iain.As far as the profiler results can be trusted, a good chunk of the time gets spent for reading individual bytes from memory, but there must be something else low-level going on that make things this bad. However, there is nothing fundamental in the structure/design that would cause this, so I think spending more time with the profiler is the only logical step now. Unfortunately my VTune license has expired and perf on Linux makes the task quite a bit more involved. If we want to be really fast, though, we need to add optimized SIMD paths, but this is currently outside of the possibilities of my time budget.
Apr 09 2015
Am 09.04.2015 um 10:59 schrieb Sönke Ludwig:Am 08.04.2015 um 20:55 schrieb Iain Buclaw via Digitalmars-d:Actually it seems to be the first issue (14425). I've already added a workaround for that on GIT master.On 8 April 2015 at 20:32, tcha via Digitalmars-d <digitalmars-d puremagic.com> wrote:I've filed two tickets for linker errors (and added a workaround for the first one): https://issues.dlang.org/show_bug.cgi?id=14425 https://issues.dlang.org/show_bug.cgi?id=14429 I'll try to reduce the pastebin reduced sample further, too, as it looks like it has yet another root cause.(...) Also tried to dustmite the minimal failing version and here is a result: http://pastebin.com/YjdvT3G4 It's my first use of it so I hope it can help to solve this problem. It outputs less errors, but also compiles fine in debug and fails to link in release.
Apr 09 2015
On 04/09/2015 10:59 AM, Sönke Ludwig wrote:As far as the profiler results can be trusted, a good chunk of the time gets spent for reading individual bytes from memory, but there must be something else low-level going on that make things this bad. However, there is nothing fundamental in the structure/design that would cause this, so I think spending more time with the profiler is the only logical step now. Unfortunately my VTune license has expired and perf on Linux makes the task quite a bit more involved.I didn't found too many issues. Most of the time is spent in parseJSONValue (looks like there are some expansive struct copies) https://github.com/s-ludwig/std_data_json/blob/1da3f828ae6c4fd7cac7f7e13ae9e51ec93e6f02/source/stdx/data/json/parser.d#L148 and skipWhitespace. This function could really take some optimization, e.g. avoid UTF decoding. https://github.com/s-ludwig/std_data_json/blob/1da3f828ae6c4fd7cac7f7e13ae9e51ec93e6f02/source/stdx/data/json/lexer.d#L345 Libdparse has some optimized ASM function, might be useful. https://github.com/Hackerpilot/libdparse/blob/51b7d9d321aac0fcc4a9be99bbbed5db3158326c/src/std/d/lexer.d#L2233
Apr 09 2015
Am 09.04.2015 um 15:20 schrieb Martin Nowak:On 04/09/2015 10:59 AM, Sönke Ludwig wrote:I'll have a look at the DOM part later. At the moment I'm looking at low level issues of the lexer. There is a lot of potential there, but it's a lot of detail work.As far as the profiler results can be trusted, a good chunk of the time gets spent for reading individual bytes from memory, but there must be something else low-level going on that make things this bad. However, there is nothing fundamental in the structure/design that would cause this, so I think spending more time with the profiler is the only logical step now. Unfortunately my VTune license has expired and perf on Linux makes the task quite a bit more involved.I didn't found too many issues. Most of the time is spent in parseJSONValue (looks like there are some expansive struct copies) https://github.com/s-ludwig/std_data_json/blob/1da3f828ae6c4fd7cac7f7e13ae9e51ec93e6f02/source/stdx/data/json/parser.d#L148and skipWhitespace. This function could really take some optimization, e.g. avoid UTF decoding.All of the lexing work happens on str.representation instead of the string directly, so no decoding should happen there.https://github.com/s-ludwig/std_data_json/blob/1da3f828ae6c4fd7cac7f7e13ae9e51ec93e6f02/source/stdx/data/json/lexer.d#L345 Libdparse has some optimized ASM function, might be useful. https://github.com/Hackerpilot/libdparse/blob/51b7d9d321aac0fcc4a9be99bbbed5db3158326c/src/std/d/lexer.d#L2233
Apr 09 2015
On Wednesday, 8 April 2015 at 18:56:00 UTC, Iain Buclaw wrote:Frankly, if we are not as fast (or elegant) as Python's json library, it should be thrown out back to the drawing board. Iain.I'll leave the speed aside, as more recent posts show improvements and I think Sönke will be able to take what he has, tweak it, and get it close to the fastest libraries. I think we can beat the competition. For elegance, dynamic languages will always be able to deal with JSON with less syntax, as you get just the basic type back out of arrays and maps, without having to explictly request a string, integer, etc. Static languages will always have more verbose JSON libraries, but they might also catch bugs more easily. We just need the short properties for converting JSON values to basic types.
Apr 16 2015
On 04/08/2015 08:32 PM, tcha wrote: Now with release numbers.D new - debug - 14.98s, 1782.0Mb8.53s, 1786.8MbD new Gdc - debug - 29.08s, 1663.9MbGDC still misses nogc support.D new Ldc - 16.99s, 1663.0Mb18.76s, 1664.1MbD new lazy - debug - 11.50s, 213.2Mb4.57s, 206MbD new lazy Gdc - 13.66s, 206.1MbCan't compile stdx.data.json with gdc-4.9.0 which doesn't yet support nogc.D new lazy Ldc - 3.59s, 205.4Mb4.0s, 205.4Mb LDC doesn't yet have the GC improvements, therefor is much slower for the DOM parsing benchmarks.
Apr 09 2015
On Thursday, 9 April 2015 at 11:49:00 UTC, Martin Nowak wrote:On 04/08/2015 08:32 PM, tcha wrote: Now with release numbers.Still getting trounced across the board by rapidjson.D new - debug - 14.98s, 1782.0Mb8.53s, 1786.8MbD new Gdc - debug - 29.08s, 1663.9MbGDC still misses nogc support.D new Ldc - 16.99s, 1663.0Mb18.76s, 1664.1MbD new lazy - debug - 11.50s, 213.2Mb4.57s, 206MbD new lazy Gdc - 13.66s, 206.1MbCan't compile stdx.data.json with gdc-4.9.0 which doesn't yet support nogc.D new lazy Ldc - 3.59s, 205.4Mb4.0s, 205.4Mb LDC doesn't yet have the GC improvements, therefor is much slower for the DOM parsing benchmarks.
Apr 09 2015
On 04/09/2015 02:10 PM, John Colvin wrote:Still getting trounced across the board by rapidjson.Yep, anyone knows why? They don't even use a lazy parser.
Apr 09 2015
On Thursday, 9 April 2015 at 12:16:43 UTC, Martin Nowak wrote:On 04/09/2015 02:10 PM, John Colvin wrote:simd optimized scanning and format-optimized inlined conversionStill getting trounced across the board by rapidjson.Yep, anyone knows why? They don't even use a lazy parser.
Apr 09 2015
On 4/9/15 5:10 AM, John Colvin wrote:On Thursday, 9 April 2015 at 11:49:00 UTC, Martin Nowak wrote:Agreed. Rapidjson is the most important baseline. -- AndreiOn 04/08/2015 08:32 PM, tcha wrote: Now with release numbers.Still getting trounced across the board by rapidjson.D new - debug - 14.98s, 1782.0Mb8.53s, 1786.8MbD new Gdc - debug - 29.08s, 1663.9MbGDC still misses nogc support.D new Ldc - 16.99s, 1663.0Mb18.76s, 1664.1MbD new lazy - debug - 11.50s, 213.2Mb4.57s, 206MbD new lazy Gdc - 13.66s, 206.1MbCan't compile stdx.data.json with gdc-4.9.0 which doesn't yet support nogc.D new lazy Ldc - 3.59s, 205.4Mb4.0s, 205.4Mb LDC doesn't yet have the GC improvements, therefor is much slower for the DOM parsing benchmarks.
Apr 09 2015
On 9 April 2015 at 13:48, Martin Nowak via Digitalmars-d <digitalmars-d puremagic.com> wrote:On 04/08/2015 08:32 PM, tcha wrote: Now with release numbers.Wasn't nogc introduced in 2.066 ? https://github.com/D-Programming-GDC/GDC/blob/master/gcc/d/VERSIOND new - debug - 14.98s, 1782.0Mb8.53s, 1786.8MbD new Gdc - debug - 29.08s, 1663.9MbGDC still misses nogc support.
Apr 09 2015
On Thursday, 9 April 2015 at 11:49:00 UTC, Martin Nowak wrote:On 04/08/2015 08:32 PM, tcha wrote: Now with release numbers.ldc -singleobj flag speeds it up dramatically ldc2 -ofjson_d_new_lazy_ldc -O5 -release -enable-inlining -w -oq -Istd_data_json/source/ std_data_json/source/stdx/data/json/*.d test_new_lazy.d ./json_d_new_lazy_ldc 2.79s user 0.08s system 99% cpu 2.868 total ldc2 -singleobj -ofjson_d_new_lazy_ldc -O5 -release -enable-inlining -w -oq -Istd_data_json/source/ std_data_json/source/stdx/data/json/*.d test_new_lazy.d ./json_d_new_lazy_ldc 1.78s user 0.08s system 99% cpu 1.869 total for comparison: ./json_rapid_cpp 0.80s user 0.30s system 99% cpu 1.106 total Bye.D new - debug - 14.98s, 1782.0Mb8.53s, 1786.8MbD new Gdc - debug - 29.08s, 1663.9MbGDC still misses nogc support.D new Ldc - 16.99s, 1663.0Mb18.76s, 1664.1MbD new lazy - debug - 11.50s, 213.2Mb4.57s, 206MbD new lazy Gdc - 13.66s, 206.1MbCan't compile stdx.data.json with gdc-4.9.0 which doesn't yet support nogc.D new lazy Ldc - 3.59s, 205.4Mb4.0s, 205.4Mb LDC doesn't yet have the GC improvements, therefor is much slower for the DOM parsing benchmarks.
Apr 09 2015
Am 09.04.2015 um 21:06 schrieb weaselcat:On Thursday, 9 April 2015 at 11:49:00 UTC, Martin Nowak wrote:Not sure, but that may also have been my recent optimizations.On 04/08/2015 08:32 PM, tcha wrote: Now with release numbers.ldc -singleobj flag speeds it up dramatically ldc2 -ofjson_d_new_lazy_ldc -O5 -release -enable-inlining -w -oq -Istd_data_json/source/ std_data_json/source/stdx/data/json/*.d test_new_lazy.d ./json_d_new_lazy_ldc 2.79s user 0.08s system 99% cpu 2.868 total ldc2 -singleobj -ofjson_d_new_lazy_ldc -O5 -release -enable-inlining -w -oq -Istd_data_json/source/ std_data_json/source/stdx/data/json/*.d test_new_lazy.d ./json_d_new_lazy_ldc 1.78s user 0.08s system 99% cpu 1.869 total for comparison: ./json_rapid_cpp 0.80s user 0.30s system 99% cpu 1.106 total Bye.D new - debug - 14.98s, 1782.0Mb8.53s, 1786.8MbD new Gdc - debug - 29.08s, 1663.9MbGDC still misses nogc support.D new Ldc - 16.99s, 1663.0Mb18.76s, 1664.1MbD new lazy - debug - 11.50s, 213.2Mb4.57s, 206MbD new lazy Gdc - 13.66s, 206.1MbCan't compile stdx.data.json with gdc-4.9.0 which doesn't yet support nogc.D new lazy Ldc - 3.59s, 205.4Mb4.0s, 205.4Mb LDC doesn't yet have the GC improvements, therefor is much slower for the DOM parsing benchmarks.
Apr 09 2015
On Thursday, 9 April 2015 at 19:17:48 UTC, Sönke Ludwig wrote:Not sure, but that may also have been my recent optimizations.Just tried it with your recent optimizations and it doesn't build with LDC 0.15.1.
Apr 09 2015
Am 09.04.2015 um 21:26 schrieb weaselcat:On Thursday, 9 April 2015 at 19:17:48 UTC, Sönke Ludwig wrote:Should work now. I just tested LDC with -singleobj and it's faster than RapidJSON! Now the DOM parser gets interesting.Not sure, but that may also have been my recent optimizations.Just tried it with your recent optimizations and it doesn't build with LDC 0.15.1.
Apr 09 2015
On Thursday, 9 April 2015 at 19:35:24 UTC, Sönke Ludwig wrote:Am 09.04.2015 um 21:26 schrieb weaselcat:What flags are you using? RapidJSON is still a lot faster for me. also, I just realized the build script has the wrong inline flag for LDC(it's using -enable-inlining instead of -inline)On Thursday, 9 April 2015 at 19:17:48 UTC, Sönke Ludwig wrote:Should work now. I just tested LDC with -singleobj and it's faster than RapidJSON! Now the DOM parser gets interesting.Not sure, but that may also have been my recent optimizations.Just tried it with your recent optimizations and it doesn't build with LDC 0.15.1.
Apr 09 2015
Am 09.04.2015 um 21:37 schrieb weaselcat:On Thursday, 9 April 2015 at 19:35:24 UTC, Sönke Ludwig wrote:I'll have to test with that exact version, because I've used my own main() function for the test. The flags were: -singleobj -release -O5 -enable-inlining -disable-bondscheck (-disable-boundscheck is only a little faster).Am 09.04.2015 um 21:26 schrieb weaselcat:What flags are you using? RapidJSON is still a lot faster for me. also, I just realized the build script has the wrong inline flag for LDC(it's using -enable-inlining instead of -inline)On Thursday, 9 April 2015 at 19:17:48 UTC, Sönke Ludwig wrote:Should work now. I just tested LDC with -singleobj and it's faster than RapidJSON! Now the DOM parser gets interesting.Not sure, but that may also have been my recent optimizations.Just tried it with your recent optimizations and it doesn't build with LDC 0.15.1.
Apr 09 2015
Am 09.04.2015 um 21:40 schrieb Sönke Ludwig:Am 09.04.2015 um 21:37 schrieb weaselcat:One thing about the D benchmark is that it uses readText(). To be a fair comparison with Rapid it would have to use cast(string)read() instead.On Thursday, 9 April 2015 at 19:35:24 UTC, Sönke Ludwig wrote:I'll have to test with that exact version, because I've used my own main() function for the test. The flags were: -singleobj -release -O5 -enable-inlining -disable-bondscheck (-disable-boundscheck is only a little faster).Am 09.04.2015 um 21:26 schrieb weaselcat:What flags are you using? RapidJSON is still a lot faster for me. also, I just realized the build script has the wrong inline flag for LDC(it's using -enable-inlining instead of -inline)On Thursday, 9 April 2015 at 19:17:48 UTC, Sönke Ludwig wrote:Should work now. I just tested LDC with -singleobj and it's faster than RapidJSON! Now the DOM parser gets interesting.Not sure, but that may also have been my recent optimizations.Just tried it with your recent optimizations and it doesn't build with LDC 0.15.1.
Apr 09 2015
On Thursday, 9 April 2015 at 19:43:13 UTC, Sönke Ludwig wrote:Am 09.04.2015 um 21:40 schrieb Sönke Ludwig:I saw that commit to the benchmark and changed it locally. They're about the same performance now comparing clang to LDC, with -inline -boundscheck=off -singleobj flags Nice.Am 09.04.2015 um 21:37 schrieb weaselcat:One thing about the D benchmark is that it uses readText(). To be a fair comparison with Rapid it would have to use cast(string)read() instead.On Thursday, 9 April 2015 at 19:35:24 UTC, Sönke Ludwig wrote:I'll have to test with that exact version, because I've used my own main() function for the test. The flags were: -singleobj -release -O5 -enable-inlining -disable-bondscheck (-disable-boundscheck is only a little faster).Am 09.04.2015 um 21:26 schrieb weaselcat:What flags are you using? RapidJSON is still a lot faster for me. also, I just realized the build script has the wrong inline flag for LDC(it's using -enable-inlining instead of -inline)On Thursday, 9 April 2015 at 19:17:48 UTC, Sönke Ludwig wrote:Should work now. I just tested LDC with -singleobj and it's faster than RapidJSON! Now the DOM parser gets interesting.Not sure, but that may also have been my recent optimizations.Just tried it with your recent optimizations and it doesn't build with LDC 0.15.1.
Apr 09 2015
On Thursday, 9 April 2015 at 19:44:57 UTC, weaselcat wrote:I saw that commit to the benchmark and changed it locally. They're about the same performance now comparing clang to LDC, with -inline -boundscheck=off -singleobj flags Nice.Also, since an LDC dev might read this - is there a reason -singleobj isn't on by default when creating an executable?
Apr 09 2015
On Thursday, 9 April 2015 at 20:01:10 UTC, weaselcat wrote:On Thursday, 9 April 2015 at 19:44:57 UTC, weaselcat wrote:I argued it should be the default a while ago and I vaguely remember agreement from at least one LDC dev. but I can't find the post now :/I saw that commit to the benchmark and changed it locally. They're about the same performance now comparing clang to LDC, with -inline -boundscheck=off -singleobj flags Nice.Also, since an LDC dev might read this - is there a reason -singleobj isn't on by default when creating an executable?
Apr 10 2015
On Friday, 10 April 2015 at 07:35:13 UTC, John Colvin wrote:On Thursday, 9 April 2015 at 20:01:10 UTC, weaselcat wrote:I still agree with you. ;) The only reason why I didn't just commit the change so far is backwards compatibility, but as we might overhaul some of the command line options soon anyway, I think we should just go ahead with that change. As noted previously, mixing one-object-per-file and all-at-once compilation (e.g. in incremental builds) does not work correctly in all cases due to frontend restrictions anyway. — DavidAlso, since an LDC dev might read this - is there a reason -singleobj isn't on by default when creating an executable?I argued it should be the default a while ago and I vaguely remember agreement from at least one LDC dev. but I can't find the post now :/
Apr 10 2015
On Thursday, 9 April 2015 at 19:40:31 UTC, Sönke Ludwig wrote:Am 09.04.2015 um 21:37 schrieb weaselcat:I can't remember which -O level inlining is enabled, but there's definitely no need to explicitly ask for it at -O5.On Thursday, 9 April 2015 at 19:35:24 UTC, Sönke Ludwig wrote:I'll have to test with that exact version, because I've used my own main() function for the test. The flags were: -singleobj -release -O5 -enable-inlining -disable-bondscheck (-disable-boundscheck is only a little faster).Am 09.04.2015 um 21:26 schrieb weaselcat:What flags are you using? RapidJSON is still a lot faster for me. also, I just realized the build script has the wrong inline flag for LDC(it's using -enable-inlining instead of -inline)On Thursday, 9 April 2015 at 19:17:48 UTC, Sönke Ludwig wrote:Should work now. I just tested LDC with -singleobj and it's faster than RapidJSON! Now the DOM parser gets interesting.Not sure, but that may also have been my recent optimizations.Just tried it with your recent optimizations and it doesn't build with LDC 0.15.1.
Apr 09 2015
On Thursday, 9 April 2015 at 20:00:28 UTC, John Colvin wrote:I can't remember which -O level inlining is enabled, but there's definitely no need to explicitly ask for it at -O5.-enable-inlining(enabled at -O2) and -inline do different things and -inline isn't automatically enabled.
Apr 09 2015
On Thursday, 9 April 2015 at 20:11:07 UTC, weaselcat wrote:On Thursday, 9 April 2015 at 20:00:28 UTC, John Colvin wrote:Sorry Sönke for polluting your thread, but I did some reading of the LLVM manual - -inline is a specific LLVM pass and not a frontend flag. Using the -partial-inliner pass instead it(the benchmark) becomes faster than rapidJSON. Bye.I can't remember which -O level inlining is enabled, but there's definitely no need to explicitly ask for it at -O5.-enable-inlining(enabled at -O2) and -inline do different things and -inline isn't automatically enabled.
Apr 09 2015
Am 09.04.2015 um 23:14 schrieb weaselcat:On Thursday, 9 April 2015 at 20:11:07 UTC, weaselcat wrote:Hm interesting, but for me LDC unfortunately crashes when adding -partial-inliner. What else did you specify?On Thursday, 9 April 2015 at 20:00:28 UTC, John Colvin wrote:Sorry Sönke for polluting your thread, but I did some reading of the LLVM manual - -inline is a specific LLVM pass and not a frontend flag. Using the -partial-inliner pass instead it(the benchmark) becomes faster than rapidJSON. Bye.I can't remember which -O level inlining is enabled, but there's definitely no need to explicitly ask for it at -O5.-enable-inlining(enabled at -O2) and -inline do different things and -inline isn't automatically enabled.
Apr 09 2015
On Thursday, 9 April 2015 at 21:52:08 UTC, Sönke Ludwig wrote:Am 09.04.2015 um 23:14 schrieb weaselcat:ldc2 -partial-inliner -boundscheck=off -singleobj -ofjson_d_new_lazy_ldc -O5 -release -w -oq -Istd_data_json/source/ std_data_json/source/stdx/data/json/*.d test_new_lazy.d it seems to segfault with -O0 optimization ./json_d_new_lazy_ldc 0.95s user 0.08s system 99% cpu 1.025 total (clang)./json_rapid_cpp 0.98s user 0.30s system 99% cpu 1.282 total (gcc)./json_rapid_cpp 0.80s user 0.31s system 99% cpu 1.108 totalOn Thursday, 9 April 2015 at 20:11:07 UTC, weaselcat wrote:Hm interesting, but for me LDC unfortunately crashes when adding -partial-inliner. What else did you specify?On Thursday, 9 April 2015 at 20:00:28 UTC, John Colvin wrote:Sorry Sönke for polluting your thread, but I did some reading of the LLVM manual - -inline is a specific LLVM pass and not a frontend flag. Using the -partial-inliner pass instead it(the benchmark) becomes faster than rapidJSON. Bye.I can't remember which -O level inlining is enabled, but there's definitely no need to explicitly ask for it at -O5.-enable-inlining(enabled at -O2) and -inline do different things and -inline isn't automatically enabled.
Apr 09 2015
Am 09.04.2015 um 23:56 schrieb weaselcat:On Thursday, 9 April 2015 at 21:52:08 UTC, Sönke Ludwig wrote:Okay, turned out that this was a 0.15.2-beta.1 issue. I've downgraded to 0.15.1 and now get a nice time of 1.30 seconds on my tablet PC!Hm interesting, but for me LDC unfortunately crashes when adding -partial-inliner. What else did you specify?ldc2 -partial-inliner -boundscheck=off -singleobj -ofjson_d_new_lazy_ldc -O5 -release -w -oq -Istd_data_json/source/ std_data_json/source/stdx/data/json/*.d test_new_lazy.d it seems to segfault with -O0 optimization ./json_d_new_lazy_ldc 0.95s user 0.08s system 99% cpu 1.025 total (clang)./json_rapid_cpp 0.98s user 0.30s system 99% cpu 1.282 total (gcc)./json_rapid_cpp 0.80s user 0.31s system 99% cpu 1.108 total
Apr 09 2015
what a difference. cool stuff Sönke! below results from a 3.1 GHz Intel Core i7 Broadwell mbp13" on os x: ldc2 0.15.1 from homebrew dmd v2.067 from homebrew optimized => " -partial-inliner -boundscheck=off -singleobj " D new lazy Ldc optimized 0.85 204.5Mb Crystal Schema 1.41 283.4Mb Crystal Pull 1.49 1.2Mb C++ Rapid 1.92 946.5Mb D new lazy dmd 2 204.5Mb D new lazy Ldc 2.12 204.6Mb D new Ldc optimized 3.19 1640.5Mb Crystal 3.23 1091.9Mb Javascript Node 3.48 905.3Mb D new Ldc 3.98 1640.5Mb Nim 4.38 1336.8Mb Go 5.34 420.3Mb D new - debug 6.34 1793.6Mb Python3 7.06 999.7Mb Rust 7.46 3041.7Mb Python Pypy 3 9.27 2710.3Mb Julia 10.09 3054.8Mb D 12.47 1219.1Mb Ruby 13.94 2167.2Mb C++ Boost 24.64 2699.4Mb D Ldc 27.38 928.1Mb y
Apr 09 2015
Am 09.04.2015 um 21:35 schrieb Sönke Ludwig:Am 09.04.2015 um 21:26 schrieb weaselcat:Okay let's say about the same speed, the numbers fluctuate quite a bit.On Thursday, 9 April 2015 at 19:17:48 UTC, Sönke Ludwig wrote:Should work now. I just tested LDC with -singleobj and it's faster than RapidJSON! Now the DOM parser gets interesting.Not sure, but that may also have been my recent optimizations.Just tried it with your recent optimizations and it doesn't build with LDC 0.15.1.
Apr 09 2015
Am 08.04.2015 um 20:32 schrieb tcha:On Wednesday, 8 April 2015 at 13:56:55 UTC, Sönke Ludwig wrote:I got the latest version using the pull parser down to the Crystal Pull parser speed*. This is about twice as slow as Rapid JSON. * Using DMD to compile. LDC is for some reason much slower, but I didn't try the -singleobj switch yet.The problem is that even the pull parser alone is relatively slow. Also, for some reason the linker reports unresolved symbols as soon as I build without the -debug flag...Unfortunatelly I overlooked that I tested it with std_data_json v 0.12.0 yesterday. So tested it again today on master: dmd and gdc failed to build in release ldc2 works I tried it also with ParseJSONStream and made fork from original benchmark with added tests (https://github.com/chalucha/benchmarks) so anyone can look (and PR) Some results: Ruby - 6.74s, 2106.2Mb Go - 5.92s, 420.9Mb D - 10.26s, 1322.5Mb D Gdc - 24.76s, 926.1Mb D Ldc - 26.31s, 925.0Mb D new - debug - 14.98s, 1782.0Mb D new Gdc - debug - 29.08s, 1663.9Mb D new Ldc - 16.99s, 1663.0Mb D new lazy - debug - 11.50s, 213.2Mb D new lazy Gdc - debug - 13.66s, 206.1Mb D new lazy Ldc - 3.59s, 205.4Mb Python - 5.89s, 1063.4Mb C++ Boost - 14.60s, 2884.8Mb C++ Rapid - 0.80s, 678.9Mb Also tried to dustmite the minimal failing version and here is a result: http://pastebin.com/YjdvT3G4 It's my first use of it so I hope it can help to solve this problem. It outputs less errors, but also compiles fine in debug and fails to link in release.
Apr 09 2015
These are my results (a little bit flaky timings because it's a tablet PC which seems to throttle the turbo boost to not exceed the TDP): std.json (DMD): 27.7 std.json (LDC): 72.4 stdx.data.json DOM (DMD): 8.2 stdx.data.json DOM (LDC): 3.96 stdx.data.json PULL (DMD): 2.96 stdx.data.json PULL (LDC): 1.61 RapidJSON: 1.21 I'd say these start to look good enough for a first fitness test.
Apr 09 2015
On 04/08/2015 03:56 PM, Sönke Ludwig wrote:The review hasn't yet started and I'm already against the "stream" parser, because it hardly deserves the names parser, it's more like a lexer. Because the benchmark code by tcha was a very specific hack for the used data structure, I tried to write a proper stream parser to have a fair comparison. This is where I stopped (it doesn't work). http://dpaste.dzfl.pl/8282d70a1254 The biggest problem with that interface is, that you have to count matching start/end markers for objects and arrays in order to skip an entry, not much fun and definitely needs a dedicated skip value function. There are 2 very nice alternative approaches in the benchmark repo. https://github.com/kostya/benchmarks/blob/master/json/test_pull.cr https://github.com/kostya/benchmarks/blob/master/json/test_schema.crThe problem is that even the pull parser alone is relatively slow. Also, for some reason the linker reports unresolved symbols as soon as I build without the -debug flag...
Apr 09 2015
Am 09.04.2015 um 14:25 schrieb Martin Nowak:On 04/08/2015 03:56 PM, Sönke Ludwig wrote:That would be a nice intermediate level parser. However, the range based parser as it is now is also useful for things like automated deserialization (which I don't want to include at this point) where you don't know in which order fields come in and where you have to use that style of filtering through the data anyway. But if inlining works properly, it should be no problem to implement other APIs on top of it.The review hasn't yet started and I'm already against the "stream" parser, because it hardly deserves the names parser, it's more like a lexer. Because the benchmark code by tcha was a very specific hack for the used data structure, I tried to write a proper stream parser to have a fair comparison. This is where I stopped (it doesn't work). http://dpaste.dzfl.pl/8282d70a1254 The biggest problem with that interface is, that you have to count matching start/end markers for objects and arrays in order to skip an entry, not much fun and definitely needs a dedicated skip value function. There are 2 very nice alternative approaches in the benchmark repo. https://github.com/kostya/benchmarks/blob/master/json/test_pull.cr https://github.com/kostya/benchmarks/blob/master/json/test_schema.crThe problem is that even the pull parser alone is relatively slow. Also, for some reason the linker reports unresolved symbols as soon as I build without the -debug flag...
Apr 09 2015
Am 09.04.2015 um 15:11 schrieb Sönke Ludwig:Am 09.04.2015 um 14:25 schrieb Martin Nowak:https://github.com/s-ludwig/benchmarks/blob/master/json/test_new_lazy.d(...) There are 2 very nice alternative approaches in the benchmark repo. https://github.com/kostya/benchmarks/blob/master/json/test_pull.cr https://github.com/kostya/benchmarks/blob/master/json/test_schema.crThat would be a nice intermediate level parser. However, the range based parser as it is now is also useful for things like automated deserialization (which I don't want to include at this point) where you don't know in which order fields come in and where you have to use that style of filtering through the data anyway. But if inlining works properly, it should be no problem to implement other APIs on top of it.
Apr 09 2015
On 04/09/2015 11:13 PM, Sönke Ludwig wrote:Am 09.04.2015 um 15:11 schrieb Sönke Ludwig: https://github.com/s-ludwig/benchmarks/blob/master/json/test_new_lazy.dThat was fast :).
Apr 09 2015
On Tuesday, 7 April 2015 at 16:37:15 UTC, Sönke Ludwig wrote:Anyone up to this? The issues of the previous discussion [1] have all been addressed now more or less, so the package is ready for a more thorough review. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ [1]: http://forum.dlang.org/thread/lt5s76$is$1 digitalmars.com#post-lt5s76:24is:241:40digitalmars.comIt seems the `in` operator (or an equivalent method) isn't supported...
Apr 08 2015
Am 08.04.2015 um 12:52 schrieb "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net>":On Tuesday, 7 April 2015 at 16:37:15 UTC, Sönke Ludwig wrote:I didn't try it, but the idea is that all operations on JSONValue are supported by std.variant.Algebraic, so anything that doesn't work, but should, should be fixed with a PR against Algebraic.Anyone up to this? The issues of the previous discussion [1] have all been addressed now more or less, so the package is ready for a more thorough review. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ [1]: http://forum.dlang.org/thread/lt5s76$is$1 digitalmars.com#post-lt5s76:24is:241:40digitalmars.comIt seems the `in` operator (or an equivalent method) isn't supported...
Apr 08 2015
On 2015-04-07 18:37, Sönke Ludwig wrote:Anyone up to this? The issues of the previous discussion [1] have all been addressed now more or less, so the package is ready for a more thorough review.Is it possible to use "toJSON" or a similar method to generate JSON from a primitive type without going through JSONValue? -- /Jacob Carlborg
Apr 16 2015
Am 16.04.2015 um 11:17 schrieb Jacob Carlborg:On 2015-04-07 18:37, Sönke Ludwig wrote:I'd like to let that be part of a more general serialization framework in top of this package instead of integrating a simplistic custom solution that will then later be obsoleted. Having said that, you can go through JSONToken instead of JSONValue for lower (computational) overhead.Anyone up to this? The issues of the previous discussion [1] have all been addressed now more or less, so the package is ready for a more thorough review.Is it possible to use "toJSON" or a similar method to generate JSON from a primitive type without going through JSONValue?
Apr 16 2015
On 2015-04-16 11:29, Sönke Ludwig wrote:I'd like to let that be part of a more general serialization framework in top of this package instead of integrating a simplistic custom solution that will then later be obsoleted.I was thinking about some low level primitives that a serialization library could use. Types that cannot be broken in to smaller parts, integer, bool and so on.Having said that, you can go through JSONToken instead of JSONValue for lower (computational) overhead.Something like? JSONToken token; token.number = 3; token.kind = JSONToken.Kind.number; toJSON(token); Or what would you recommend a serialization library used? -- /Jacob Carlborg
Apr 16 2015
Am 16.04.2015 um 13:03 schrieb Jacob Carlborg:On 2015-04-16 11:29, Sönke Ludwig wrote:Yes, just without setting the kind explicitly (it's set automatically by assigning to the number property). Instead of toJSON(), writeJSON() would probably be more appropriate to avoid additional allocations.I'd like to let that be part of a more general serialization framework in top of this package instead of integrating a simplistic custom solution that will then later be obsoleted.I was thinking about some low level primitives that a serialization library could use. Types that cannot be broken in to smaller parts, integer, bool and so on.Having said that, you can go through JSONToken instead of JSONValue for lower (computational) overhead.Something like? JSONToken token; token.number = 3; token.kind = JSONToken.Kind.number; toJSON(token);Or what would you recommend a serialization library used?The simplest target for a serialization library would be to generate a stream of JSONParserNodes. That way the serializer doesn't have to keep track of nesting levels and can reuse the pretty printing functionality of stdx.data.generator. However, this currently requires an input range of JSONParserNodes, which looks like it is suboptimal for a serializer (either requires an explicitly allocated node array, or a strange serializer architecture that directly works as an input range). For that reason I'm thinking about providing an output range interface like so: auto dst = appender!string; auto rng = jsonOutputRange(dst); JSONParserNode n; // start an object n.kind = JSONParserNode.Kind.objectStart; rng.put(n); // write a single entry "foo": 10.5 n.key = "foo"; rng.put(n); rng.put(10.5); // write another entry "bar": true n.key = "bar"; rng.put(n); rng.put(true); // finish the object n.kind = JSONParserNode.Kind.objectEnd; rng.put(n); writefln("JSON: %s", dst.data); What do you think? BTW, looks like JSONToken could use a set of constructors for more convenient in-place construction.
Apr 16 2015
On Thursday, 16 April 2015 at 12:17:55 UTC, Sönke Ludwig wrote:Am 16.04.2015 um 13:03 schrieb Jacob Carlborg:I think serialiastion for this JSON library should probably be considered out of scope until we have a general serisalisation API. Then once we have both, we can marry the two together. So as you say, the support from your end seems to be there. There just needs to be a serialiser to hook into it.On 2015-04-16 11:29, Sönke Ludwig wrote:Yes, just without setting the kind explicitly (it's set automatically by assigning to the number property). Instead of toJSON(), writeJSON() would probably be more appropriate to avoid additional allocations.I'd like to let that be part of a more general serialization framework in top of this package instead of integrating a simplistic custom solution that will then later be obsoleted.I was thinking about some low level primitives that a serialization library could use. Types that cannot be broken in to smaller parts, integer, bool and so on.Having said that, you can go through JSONToken instead of JSONValue for lower (computational) overhead.Something like? JSONToken token; token.number = 3; token.kind = JSONToken.Kind.number; toJSON(token);Or what would you recommend a serialization library used?The simplest target for a serialization library would be to generate a stream of JSONParserNodes. That way the serializer doesn't have to keep track of nesting levels and can reuse the pretty printing functionality of stdx.data.generator. However, this currently requires an input range of JSONParserNodes, which looks like it is suboptimal for a serializer (either requires an explicitly allocated node array, or a strange serializer architecture that directly works as an input range). For that reason I'm thinking about providing an output range interface like so: auto dst = appender!string; auto rng = jsonOutputRange(dst); JSONParserNode n; // start an object n.kind = JSONParserNode.Kind.objectStart; rng.put(n); // write a single entry "foo": 10.5 n.key = "foo"; rng.put(n); rng.put(10.5); // write another entry "bar": true n.key = "bar"; rng.put(n); rng.put(true); // finish the object n.kind = JSONParserNode.Kind.objectEnd; rng.put(n); writefln("JSON: %s", dst.data); What do you think? BTW, looks like JSONToken could use a set of constructors for more convenient in-place construction.
Apr 16 2015
On 2015-04-16 14:28, w0rp wrote:I think serialiastion for this JSON library should probably be considered out of scope until we have a general serisalisation API. Then once we have both, we can marry the two together. So as you say, the support from your end seems to be there. There just needs to be a serialiser to hook into it.I'm working on the general serialization API. I'm working on rewriting Orange [1] to get it into Phobos. I'm asking about an API for converting basic types, that cannot be further taken apart, to JSON. [1] https://github.com/jacob-carlborg/orange -- /Jacob Carlborg
Apr 16 2015
On 2015-04-16 14:17, Sönke Ludwig wrote:The simplest target for a serialization library would be to generate a stream of JSONParserNodes. That way the serializer doesn't have to keep track of nesting levels and can reuse the pretty printing functionality of stdx.data.generator. However, this currently requires an input range of JSONParserNodes, which looks like it is suboptimal for a serializer (either requires an explicitly allocated node array, or a strange serializer architecture that directly works as an input range).The serialization library I'm working on has an output range interface.For that reason I'm thinking about providing an output range interface like so: auto dst = appender!string; auto rng = jsonOutputRange(dst); JSONParserNode n; // start an object n.kind = JSONParserNode.Kind.objectStart; rng.put(n); // write a single entry "foo": 10.5 n.key = "foo"; rng.put(n); rng.put(10.5); // write another entry "bar": true n.key = "bar"; rng.put(n); rng.put(true); // finish the object n.kind = JSONParserNode.Kind.objectEnd; rng.put(n); writefln("JSON: %s", dst.data); What do you think?That looks very handy, that would be great to have. -- /Jacob Carlborg
Apr 16 2015
Am 07.04.2015 um 18:37 schrieb Sönke Ludwig:Anyone up to this? The issues of the previous discussion [1] have all been addressed now more or less, so the package is ready for a more thorough review. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ [1]: http://forum.dlang.org/thread/lt5s76$is$1 digitalmars.com#post-lt5s76:24is:241:40digitalmars.comSo, since Dicebot has stepped down from his review manager role, is there anyone else who would take that over? It's a little bit of a shame to have that code just lying around for so long.
Jul 26 2015
On Sunday, 26 July 2015 at 09:09:51 UTC, Sönke Ludwig wrote:Am 07.04.2015 um 18:37 schrieb Sönke Ludwig:I can do it. It's just announcing and counting votes, right? Is the formal review now? AtilaAnyone up to this? The issues of the previous discussion [1] have all been addressed now more or less, so the package is ready for a more thorough review. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ [1]: http://forum.dlang.org/thread/lt5s76$is$1 digitalmars.com#post-lt5s76:24is:241:40digitalmars.comSo, since Dicebot has stepped down from his review manager role, is there anyone else who would take that over? It's a little bit of a shame to have that code just lying around for so long.
Jul 27 2015
Am 27.07.2015 um 22:00 schrieb Atila Neves:On Sunday, 26 July 2015 at 09:09:51 UTC, Sönke Ludwig wrote:That'd be great, thanks! I *think* that's all (maybe also updating the wiki) and since there is no other review going on, it should be possible to start a new one now. But I also don't know for sure...Am 07.04.2015 um 18:37 schrieb Sönke Ludwig:I can do it. It's just announcing and counting votes, right? Is the formal review now? AtilaAnyone up to this? The issues of the previous discussion [1] have all been addressed now more or less, so the package is ready for a more thorough review. Code: https://github.com/s-ludwig/std_data_json Docs: http://s-ludwig.github.io/std_data_json/ [1]: http://forum.dlang.org/thread/lt5s76$is$1 digitalmars.com#post-lt5s76:24is:241:40digitalmars.comSo, since Dicebot has stepped down from his review manager role, is there anyone else who would take that over? It's a little bit of a shame to have that code just lying around for so long.
Jul 27 2015
On Monday, 27 July 2015 at 20:30:23 UTC, Sönke Ludwig wrote:Am 27.07.2015 um 22:00 schrieb Atila Neves:I guess folks would be much more willing to do this if it was defined somewhere what it exactly means ;) --StephanOn Sunday, 26 July 2015 at 09:09:51 UTC, Sönke Ludwig wrote:That'd be great, thanks! I *think* that's all (maybe also updating the wiki) and since there is no other review going on, it should be possible to start a new one now. But I also don't know for sure...Am 07.04.2015 um 18:37 schrieb Sönke Ludwig:I can do it. It's just announcing and counting votes, right? Is the formal review now? Atila[...]So, since Dicebot has stepped down from his review manager role, is there anyone else who would take that over? It's a little bit of a shame to have that code just lying around for so long.
Jul 28 2015
Am 28.07.2015 um 10:38 schrieb extrawurst:On Monday, 27 July 2015 at 20:30:23 UTC, Sönke Ludwig wrote:Just found something: http://wiki.dlang.org/Review/Process#Review_Manager(...) That'd be great, thanks! I *think* that's all (maybe also updating the wiki) and since there is no other review going on, it should be possible to start a new one now. But I also don't know for sure...I guess folks would be much more willing to do this if it was defined somewhere what it exactly means ;) --Stephan
Jul 28 2015
On 2015-07-28 11:23, Sönke Ludwig wrote:Just found something: http://wiki.dlang.org/Review/Process#Review_ManagerI would add "making sure the review queue is updated". -- /Jacob Carlborg
Jul 28 2015