views:

165

answers:

3

Hello Everyone,

Is it possible to optimize speed of a mission critical application developed in Django with Cython

Sorry in advance if it doesn't make sense......as i am new to django.

Recently i have read on the internet that you can use cython and turn a python code to c like speed......so i was wondering is this possible with django

+2  A: 

Well, yes, but most things a web app does won't really benefit from this sort of change unless you have firm proof that it will. Profile twice, optimize once.

Ignacio Vazquez-Abrams
+1: "Profile twice, optimize once".
S.Lott
+3  A: 

Is it possible to optimize speed of a mission critical application developed in Django with Cython

It's doubtful.

Most of a web application response time is the non-HTML elements that must be downloaded separately. The usual rule of thumb is 8 static files per HTML page. (.CSS, .JS, images, etc.)

Since none of that static content comes from Django, most of your web application's time-line is Apache (or Nginx or something outside Django).

When looking at just the time to produce the HTML, you'll find that most of the time is spent waiting for the database (even if it's in-memory SQLite, you'll see that the database tends to dominate the timeline)

When you're through making Apache and the database go fast, then -- and only then -- you can consider the Python elements.

Bottom Line. Don't waste any of your time on making Django and Python go fast.

S.Lott
A: 

Echoing the other answers, this is unlikely to gain you any specific gains, unless of course, you've profiled a specific case where some benefit could be derived.

Adding to the answers, I want to point out a list of web optimizations from the Yahoo's web team. These are measured and proven gains in areas applicable to many websites and worth studying:

The Exceptional Performance team has identified a number of best practices for making web pages fast. The list includes 35 best practices divided into 7 categories.

ars