Posted in April 2009

Zend Framework vs. Django Performance

This is not a scientific nor rigorious test…  But, here’s some interesting data for people to chew on.  I’ve got a production site built using the Zend Framework and a beta site built using django.  What’s interesting is the “Time spent downloading a page” graphs from Google Webmaster Tools.

The Zend Framwork Graph — average speed is 458 ms with a min of 246 ms

wink_time

The django graph — you can see where I changed from CGI style to FCGI in the speed — average is 531, and a min is 81ms — though my eyeball average for the month of April is 100ms.

zapquiz_time1

The nice part is these graphs have the same scale, so it’s pretty clear that once I switched from CGI to FCGI (under lighttpd) that the django performance is 4x better than the ZF.

Tagged , ,

Django performance

I’ve been working on ZapQuiz and still having the love hate with python and django.  Areas that I would like see improved:

Template Variables : I’m currently doing strange things like:

 <body id="{% block tmpl_id %}{% endblock %}" class="{% block tmpl_class %}{% endblock %}">

and then the included template is setting those variables.  Which when you think about it is a bit off..

Footer Scripts: I would like to be able to stuff all the scripts in the footer, but there’s no easy way to faciliate “block append”  where any included template could include a short snippet to be appended to the footerscript block.

Template Performance: Ok, it’s good.  It really helped when I found a script to cache the parsed version of a template for rendering.  My page render time for most pages is < 100ms, which when you consider it’s running on a 5 year old machine.

Models: The models are a slippery slope, I’m finding that 90% of my functionality is drifting into the model layer, which is good… but, I don’t feel like there’s good seperation.

File Layouts: This really is django’s strongest and weakest point, it wants everything to be modular, but almost takes it too far for an application.  What’s an app whats a webapp?

Auth: django.contrib.auth sucks!  It forces two paradimes that should be abolished… SESSIONS and USER=AUTHENTICATION.   Long ago I learned that to use a SESSION object is a flawed approach, you should cache the database objects and reconstruct state as necessary, not depend on having things like a shoppping cart in memory.   The second bit is that if I want to provide multiple authentications system email+password, user+password, OAuth, Facebook having your user object tied to authentication is a bad practice.   The biggest problem is that I don’t want to re-write all of auth yet…

That’s it today…more ranting later when…  Check out my quick quiz site and send me feedback… I just need one solid day of love and I think it’ll be done…

iPhone Objective-C bug?

Funny bug from XCode and objective-c …


warning: initialization from distinct Objective-C type

For the following block of code:

        // Quiz *qz = [[Quiz alloc] initFromDict: qdata];
        Quiz *quiz = [Quiz alloc];
        [quiz initFromDict: qdata];

From what I’ve read I ended up with the uncommented code as the operational code, since it implies that something bad will happen…  Before you ask “initFromDict” returns a (Quiz *) object..