Comparing the speed of JSONItem, JSONItem_MTC, and Xojo.Data...

I could make functions to convert to dictionary/variant/array if needed.
But not sure what speed would come out of that.

[quote=430315:@Christian Schmitz]I could make functions to convert to dictionary/variant/array if needed.
But not sure what speed would come out of that.[/quote]
I’m not sure either. But I imagine if it were done inside the plugin, you could get closer to Xojo.Data than any Xojo-based code could.

Next MBS Plugin will have Convert method to provide quick replacement for JSON parsing:

Dim MBSJSON As New JSONMBS(Contents) Dim t As Variant = MBSJSON.Convert

This will give dictionary, array and variants as needed and I hope you can benchmark again with next prerelease.

[quote=432342:@Christian Schmitz]Next MBS Plugin will have Convert method to provide quick replacement for JSON parsing:

Dim MBSJSON As New JSONMBS(Contents) Dim t As Variant = MBSJSON.Convert

This will give dictionary, array and variants as needed and I hope you can benchmark again with next prerelease.[/quote]
Cool, I’ll keep an eye out.

[quote=429819:@Christian Schmitz]
see example project: JSONItem clone
https://monkeybreadsoftware.net/example-util-json-jsonitemclone.shtml[/quote]

just as a heads-up: this code is not 64-bit ready:

Select case [b]v.Type[/b] case Variant.TypeString Return JSONMBS.NewStringNode(v.StringValue) case Variant.TypeBoolean Return JSONMBS.NewBoolNode(v.BooleanValue) case Variant.TypeDouble, Variant.TypeSingle, [b]Variant.TypeInteger[/b] Return JSONMBS.NewNumberNode(v.DoubleValue) else Break end Select

You’ll have to test against Variant.TypeInt32 and Variant.TypeInt64 because of <https://xojo.com/issue/41173>

Thanks. I’ll update it.

So the results are good with the upcoming MBS methods. For a recap, we’re testing parsing json, generating compact json, and generating pretty json. The new MBS code “competes” with Xojo.Data and the M_JSON module, so I’m only going to include those results here for comparison. All the test variables are the same: same hardware, same Xojo version, same JSON file.

Xojo.Data parsed in 227ms on Mac and 1,884ms on Windows. M_JSON parsed in 965ms on Mac and 647ms on Windows. And JSONMBS.Convert parsed in 238ms on Mac and 216ms on Windows.

For compact JSON, Xojo.Data generated in 174ms on Mac and 432ms on Windows. M_JSON generated in 1,164ms on Mac and 913ms on Windows. JSONMBS.Convert generated in 402ms on Mac and 459ms on Windows.

And for pretty JSON, Xojo.Data generated in 1,262ms on Mac and 1,031ms on Windows. M_JSON generated in 1,219ms on Mac and 952ms on Windows. JSONMBS.Convert generated in 412ms on Mac and 474ms on Windows.

So these new methods offer some clear advantages. While slower in some tests, if you need to generate pretty JSON, they have a very significant advantage over all other options. For those already using MBS plugins, they’re worth switching to. I’m personally going to hold out for API 2.0 before making any changes to my code though.

Thanks for testing.
If you get some example for me to fine tune, please email me the project.

[quote=432403:@Christian Schmitz]Thanks for testing.
If you get some example for me to fine tune, please email me the project.[/quote]
If I do that, my test would not longer be fair.

Thanks for doing all this testing Thom.

No problem. I’ll still check if I can improve something, e.g. avoid extra copies of data.

I’ll update my classes too to put Thom’s test parameters and the results in constants. 0 ms!

:stuck_out_tongue:

[quote=432413:@Kem Tekinay]I’ll update my classes too to put Thom’s test parameters and the results in constants. 0 ms!

:P[/quote]
AHHEEEM! Faster please! :stuck_out_tongue:

Thom,

If you have an Einhugur license, could you please add the new (April 2019) JSON plugin II 1.0 from Einhugur to your test?

I want the fastest I can get, but preferably without spending more money. I have a current Einhugur license, but IIRC the last MBS license I have is from 2014 (Einhugur has met most of my needs and is a lot cheaper to renew)…

I am looking to speed up processing in an AloeExpress Xojo server app as much as possible, for an in-house client server application (not one I will earn money for) that I have in mind, and I don’t want to have to deal with the new framework TEXT type.

Thanks,

  • karen

Sorry, I don’t have an Einhugur license. Is there a demo?

I found it. I’ll add it to my tests, but I’m pretty confident already that it’s not the route you want to take. Like the MBS plugin, raw performance may be fast, but converting to and from the plugin-specific classes tends to blow away any performance gains.

I hoped my Convert methods could help…
But dictionary and array access is speed limited.

[quote=435806:@Christian Schmitz]I hoped my Convert methods could help…
But dictionary and array access is speed limited.[/quote]
Oh it absolutely does. I’m comparing Einhugur’s JSON classes to your JSONItemMBS classes. The new Convert method is probably the best overall choice for performance right now.

Hi Thom,

If you have run the tests already, can you share the details of how the new Einhugur JSON plugin compares to all the other options?

Sometimes second best is good enough if you already have it! :wink:

Thanks,

  • karen

The Einhugur one also can do the Auto variant convert thing.

Note though I personally don’t think thats the right thing to focus on, I know at least for me I would never use it like that in real world application. The automatic variant structure is nice to do tests and other such but practical in use I would say no at least I would never design my own applications like that.