Wednesday, June 30, 2010

WebYaST: Switch from XML into JSON (day two)

Hi!
Today I compared JSON vs XML communication in WebYaST.
And the result is ... there's no big difference for us.
Calling groups index page without profiling takes almost same time with XML or JSON:

JSON
5.59, 5.7, 5.59, 5.82, 6.01 (average 5.742)

XML
5.99, 5.98, 5.88, 6.17, 5.96 (average 5.996)


Comparing processor cycles - JSON is winner, but the difference is not so visible, because there are much bigger time consumers than XML/JSON parsing.
Maybe (as jreidinger suggested) caching on client side could improve the performance ...

Tuesday, June 29, 2010

WebYaST: Switch from XML into JSON (day one)

This week I'll continue on project that started on recent WebYaST Workshop:WebYaST_Performance

Result from previous tests was that bundled reXML parser is slowest from all ;-)
Now I'd like to continue with comparison XML and JSON performance. For this purpose I created webclient json branch in our git repository.


To install profiling extension you'll need to add repository http://download.opensuse.org/repositories/devel:/languages:/ruby:/extensions/openSUSE_11.2
and install package rubygem-ruby-prof. Also to see results from profiling you'll need kcachegrind package.

I started some tests with Firefox firebug extension (5 measurements from each and then calculate average). First one without any modification, then with profiling enabled.

xml (rexml), no benchmarkingxml (rexml), ruby-prof enabled
5.536.3
6.535.71
6.155.79
6.555.78
6.155.99
6.1825.914







On this picture you can see (selected line is xml parsing process) with luck we can speed up 1/5 times (about 1 sec in my case). There's almost no difference between creating json and xml output: Calling http://localhost:4984/groups.xml takes average time 655ms, http://localhost:4984/groups.json takes average time 621.4ms.
In rest-service there are some problems - json output is not valid, jreidinger is working on it.
I'll continue tomorrow.