Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Highlighted
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

ConferenceApp Secrets #3: JSON vs XML

perhaps you've read my last articles providing some secrets from BBJam Asia Conference APP I developed for BlackBerry.

 

Parts# 1 and #2 are also published via BlackBerry Developer Blog

 

I just published the next part: http://appbus.wordpress.com/2013/12/02/conference-app-secrets-3-json-vs-xml/

 

I'm demonstrating how fast it is reading from JSON instead of XML.

 

All my data from my conference apps is persisted as JSON data - I'm not using a database.

 

This article will show you the speed of JSON and I surrounded it with some code to display the values in a BarChart using plain Cascades Container.

 

Next part of this series will take a deeper look at the way I'm caching and persistsing data using JSON data files.

 

Have fun and if there are questions feel free to ask them here.

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: ConferenceApp Secrets #3: JSON vs XML

It would be quite interesting to see a comparison to SQLite.
Creating a sql method to write addresses into a database should be easy.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: ConferenceApp Secrets #3: JSON vs XML


simon_hain wrote:
It would be quite interesting to see a comparison to SQLite.
Creating a sql method to write addresses into a database should be easy.

that's on my todo

I have known that you'll ask this ;-)

 

will be important esp for the next part wher I'm searching and filtering the data

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: ConferenceApp Secrets #3: JSON vs XML

added an image to make it easier to understand the Layouting

http://appbus.wordpress.com/2013/12/02/conference-app-secrets-3-json-vs-xml/

 

 

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 169
Registered: ‎03-25-2011
My Device: Playbook, Z10 L.E.
My Carrier: Vodafone NL

Re: ConferenceApp Secrets #3: JSON vs XML

Another really good post Ekke. Congratulations! Some time ago I was dealing with some JSON files and I had some dificulties using JDA. Your post would have been a big help.

 

In terms of ease of use, I guess the future is bright for BB10 because Qt 5 will finally include support for JSON files! Now it will be a matter of time until BB10 also migrates to Qt 5. (This is a bit irrelevant since BB10 already provide JDA but it's another tool anyway).

 

And in terms of performance, here's another cool comparison between different C++ JSON parsing libraries, some already ported to BB10.

 

Ekke, have you ever tried RapidJSON or QJson?

 

Cheers!

Cheers!
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: ConferenceApp Secrets #3: JSON vs XML


billbsb wrote:
....

 

Ekke, have you ever tried RapidJSON or QJson?

 


not yet

 

I'm always trying to use the defaults from cascades - if then something is missing or slow I'm testing other libraries.

 

 

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 206
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Re: ConferenceApp Secrets #3: JSON vs XML

I brought up JSON vs XML vs SQL a while ago ( in a thread I think you were involved in ) on the forums. It's nice to see some data on JSON vs XML.

 

It would be interesting to see how SQL compares to JSON. If my experience is typical, you'd see even greater speed improvements by converting your initial data set to an SQLite DB (which you can do with MySQL, which supports importing XML into a DB, then exporting into SQL inserts which you can run on a SQLite database). Unfortunately, the initial conversion of XML to SQL can take a while if you're not familiar with a tool that can easily make the change.

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: ConferenceApp Secrets #3: JSON vs XML

comparing JSON to SQL is on my TODO list and will follow later.

 

next article will be focused on How I'm using JSON to persist / cache my Conference Data and HowTo search for Speakers or Sessions.

 

then it will make sense to do the same using SQL and compare speed.

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: ConferenceApp Secrets #3: JSON vs XML

just did some testing with SQLite

it's even faster then JSON DataAccess,

but the handling isn't as easy (needs more code)

will add this to the sample app and blog about it later

so for upcoming Secrets#4 with filtering, updating, ... we can then compare XML, JSON, SQLite

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner
Developer
Posts: 1,746
Registered: ‎04-08-2010
My Device: Passport Silver, PRIV
My Carrier: Telekom.de, O2, Vodafone

Re: ConferenceApp Secrets #3: JSON vs XML

[ Edited ]

you asked me to compare XML and JSON also with SQLite and I did it

changes just committed to Github

https://github.com/ekke/cascades_json_vs_xml

blog article will follow

 

short summary:

after testing JSON vs XML JSON was the clear winner, where reading from JSON was up to 30 times faster then doing this from XML

 

Read/Write of 10'000 Addresses SQL is even faster then JSON

Read/Write of 119 Speakers SQL is slower then JSON

 

JSON is very flexible and needs much less code then (generic) solutions for SQLite,

where SQLite is lightning fast using many rows

 

I will write a detailed blog article on this so we'll have something to discuss,

because the answers when to use what aren't easy, as always: "it depends...." ;-)

 

have fun

-------------------------------------------------------------------------------
ekke (independent software architect, rosenheim, germany)

BlackBerry Elite Developer
BlackBerry Platinum Enterprise Partner
International Development native Mobile Business Apps
BlackBerry 10 | Qt Mobile (Android, iOS)
Workshops / Trainings / Bootcamps

blog: http://ekkes-corner.org
mobile-development: http://appbus.org Twitter: @ekkescorner