Linux for Video Production (O'ReillyNet)
Posted Aug 20, 2005 7:29 UTC (Sat) by
drag (subscriber, #31333)
In reply to:
Linux for Video Production (O'ReillyNet) by djabsolut
Parent article:
Linux for Video Production (O'ReillyNet)
Psyco can offer _some_ very nice acceleration for Python apps... but at expense for memory usage...
Which isn't a bad thing. Python's garbage collector is very agressive and Python program's average memory usage is MUCH smaller then something like Java or .NET even.
The problem with having a x2 to x3 speed up is that it's still very much slower then (good) c/c++ programming. (it's a hell of a lot faster then bad c/c++ programming)
The problem with saying something like 'Oh, it's using python so it much be slow' is because it's a very ignorant (and forgivable) statement.
What is missing is a understanding of python-style developement for applications that require good speed, which is basicly that you don't program in python when speed matters, you program in C or C++ and then incorpate that functionality as code into your larger python-based program.
What you generally do is initially write out your program in Python and using pre-made/tested/optimized modules/frameworks from third parties were appropriate. Then after you get it 'correct', or close enough to what you want and have it provide the functionality you want, then you break out the profiler and study what parts of the programs are taking the most time to accomplish.
Typically the majority of the program consumes the minority of the resources.. it's certain things, certain parts of the program that end up being time-critical. You rewrite those parts that are causing the slow-downs as modules in C/C++ code.
Then everytime you want to make a change you don't have to recompile the entire stupid thing.. end users have much more access to the code so they can 'fix' problems themselves. Then the important parts are written in C and are designed to only take specific inputs from the python stuff, proccess as fast as possible, and then give specific outputs that can be intellegently delt with by the python code.
In this specific application's case, PiTiVi, Python may make a good choice. A bad UI written in C is going to slow down users much more then a good UI in python (that would also be easily modifiable and scriptable if done correctly). At it's core it's going to depend on gstreamer to do the heavy lifting... And that's definately not written in Python and should be just as fast as any other C code. So it all depends on how robust gstreamer will be. (will I like gstreamer idea's alot.. I still can't get it to run totem on powerpc without crashing)
(
Log in to post comments)