On Sep 14, 2011, at 11:07 AM, Anthony wrote:

> On Wednesday, September 14, 2011 1:25:37 PM UTC-4, Ross Peoples wrote:
> I also took Anthony's advice and removed all the models, except for three 
> lines from db.py that are required:
> 
> from gluon.tools import Service
> service = Service()
> response.generic_patterns = ['*']
> 
> This has changed the results quite a bit:
> 
> [snip] 
> 
> FINAL RESULTS
> ==================================
> JSON-RPC Average Time: 56.80 ms
> JSON-RPC Total Time Taken: 9694.15 ms
> XML-RPC Average Time: 17.99 ms
> XML-RPC Total Time Taken: 5815.11 ms
> Result: XML won by: 38.82 ms (315.8% faster)
> 
> 
> To make sure I got accurate results, I restarted the server, and ran the test 
> twice before pasting these numbers.
> 
> There seems to be a staggering difference between the XML-RPC and JSON-RPC 
> implementations when models aren't used. For some reason, XML-RPC is running 
> more than 300% faster, while the JSON-RPC remains the same.
> 
> How can the JSON times have increased (slightly) with the removal of all the 
> db.py code? This seems odd.
> 

The JSON-vs-XML speed issue probably has to do with using the pure-Python 
simplejson library from contrib. In class Service, we should try to import the 
Python library json (2.6+), then simplejson (from the system, which might have 
the C optimizations) and only then fall back on contrib.simplejson.

This would have to be done in gluon.serializers, too, and you want to make sure 
that the jsonrpclib is using the right json library.

Reply via email to