About 10 years ago, I wrote a C app that would read scores from
football games and calculate rankings based on the outcome of the
games.  In fact, I still use this app.  You can view my rankings at
http://members.cox.net/jocknerd/football.

A couple of years ago, I got interested in Python and decided to
rewrite my app in Python.  I got it to work but its painfully slow
compared to the C app.  I have a file containing scores of over 1500
high school football games for last season.  With my Python app, it
takes about 3 minutes to process the rankings.  With my C app, it
processes the rankings in less than 15 seconds.

The biggest difference in my two apps is the C app uses linked lists.
I feel my Python app is doing too many lookups  which is causing the
bottleneck.

I'd love some feedback regarding how I can improve the app.  I'd like
to drop the C app eventually.  Its really ugly.  My goal is to
eventually get the data stored in PostgreSQL and then have a Django
powered site to process and display my rankings.

You can download the source code from 
http://members.cox.net/jocknerd/downloads/fbratings.py
and the data file from http://members.cox.net/jocknerd/downloads/vhsf2006.txt

Thanks!

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to