Python performance tips

python.jpgAnyone who's programmed in Python will tell you that it's often easy to write a script, but it's always hard to write an efficient script. This resource from the main Python wiki will teach you how to program for speed and performance.

The article covers many traps which people fall prey to when programming Python, such as repeating tasks too often, fetching too much data, and treating Python as if it were C. It shows how to recognize these mistakes when they occur, and how to fix them when they do. If you do any Python scripting, you should give this article a look.



Related Posts


Related posts are selected automatically based on their content.


5 Responses to “Python performance tips”  

  1. 1 littlebob Edit Link

    I have been using python for a while and wondered if there is better ways to do certain tasks, in several of the cases listed on that page I was doing it the slower way.

  2. 2 Ideasman42 (Campbell Barton) Edit Link

    A while back I wrote a doc on Blender/Python performance tips, most of this is still relevant

    http://en.wikibooks.org/wiki/Blender_3D:_Blending_Into_Python/Optimize

  3. 3 pell Edit Link

    Thanks, PlantPerson. After reading just part of it, I've already improved a script I'm working on.

  4. 4 undeadbydawn Edit Link

    What I would reeeaaaally like is a relatively easy way of adding python scripts to the Mac Blender distro. The current process [which involves hacking Finder and hunting blind for the right folder, then hoping that Blender accepts its existance] is an utter pig, which mostly doesn't even work.

    this makes using many funky new powers utterly frustrating at the very best of times. I mostly just give up.

  5. 5 Ideasman42 (Campbell Barton) Edit Link

    @undeadbydawn, Iv heard of this, odd that the finder dosnt have it as a UI pref like linux/windows, otherwise why dont you set a user scripts directory in your prefs?

Leave a Reply