Hacker News new | past | comments | ask | show | jobs | submit login

Can someone post performance tips for Python? Either links or just suggestions. I've been coding in Python for a couple weeks and I'm not sure about what tools I have at my disposal for identifying bottlenecks and subsequently how to address those bottlenecks.




My suggestion: your bottleneck is highly unlikely to be Python. Most web applications get to wait on DB access, network latency, and then browser rendering. All the backend optimization in the world just gets you to these bottlenecks faster.

(It is also a whole lot of black magic compared to front-end optimization. See any of the presentations by the YSlow guys -- google [high performance web sites] and look for the slides or videos. They give simple, tested, repeatable "do this and it will work" best practices. Backend optimization, on the other hand, relies far too much on handwavy lore and near-useless-or-actually-harmful micro-optimizations. For example, "StringBuffers are sooooooo much faster than String concatenation!")


"your bottleneck is highly unlikely to be Python. Most web applications get to wait on DB access, network latency, and then browser rendering"

I second that. My experience is first look into the DB time and second browser rendering. I have thought Python was the cause for slowness many times and each time it again proved to be DB time. Also, don't run multiple selects to the database for a set of records, make it one select.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: