DIGG IT!
Published
Tuesday, June 28, 2005
at
5:52 AM
.
As you can tell I am biased, I love interpreted languages. It is a simple decision for me, it is 95% productivity and 5% performance.&
I use Python and ActionScript extensively in my daily work. I get a very high level of productivity from using Python given its solid standard library and its simple readable syntax. Object oriented concepts are not buried in quirky syntax and you can do quite a lot in 5-6 lines of code. ActionScript is also very productive. It has a simple set of intrinsic classes that can be used to quickly build any type of object and integrate with components and external data sources. AS is very malleable and is an excellent language for UI work. Both allow for cross platform and cross device applications. As a client/server pair they are a near perfect solution (NEW BUSINESS,WINK,WINK,NUDGE,NUDGE).
As for performance, you can always scale something after you have working code but rarely before. As many will attest, pre-mature optimization is a hidden killer of so many projects. With a high level language you arrive at a testing phase much faster than with a compiled language, this is very true for Python development.
Python internally is built on C and internal objects are equivalent to their C counterpart(at runtime, they are C objects). Python just provides a light layer atop C and exposes objects in an interactive and interpreted manner. Performance wise, under the hood you are working with C. Second Python has some external libraries to speed up the execution of slower aspects of your application. Below are four more useful performance enhancements for Python:
Python C API -
http://www.python.org - Python can be extended with C. You compile modules in C and you can access them from within Python itself. Ideally slow modules can be compiled and run at C speed.
PSYCO -
http://psyco.sourceforge.net/ - Psyco is a Python extension module which can massively speed up the execution of any Python code. 2x to 100x speed-ups, typically 4x. Typically requires adding 2 lines of code into your application.
PYREX -
http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/ - Pyrex lets you write code that mixes Python and C data types any way you want, and compiles it into a C extension for Python.
IRONPYTHON -
http://www.ironpython.com/ - IronPython is a new Python implementation targeting the .NET and Mono platforms. You write code in Python and out comes MSIL.
The other thing to keep in mind is that computers are getting much faster. Languages like Python and ActionScript stand to get exponentially faster over time regardless of changes to the runtimes. I am sure we will see massive performance gains in both Python and ActionScript in the near future.
My 2 cents.
Ted ;)
Interestingly, i've been reading about how we are reaching the limits of increasing CPU speeds. The near future gains are going to be coming from multi-cpu cores.
Unfortunately, Python has issues with threading (the GIL), and this is one of the big issues which the dev's are trying to address.
This is also something that Flash is going to have to deal with, since it is a single thread model too.
The day's of saying "wait 6 months, we will have .5 Ghz more speed" are at an end, and we the developers are going to have to start finding more cleaver ways to improve the performance of our products. Well, and hope the dev's of Flash and Python are even more cleaver, and make the player/VM more efficient.
j
ps. please note that i'm not saying that Python or AS/Flash are not to be used, or won't get faster. Its just going to be more and more difficult to squeeze out more speed, and that we can no longer rely on CPU speed upgrades
So your willing to bet against Moore's law with AMD,Intel,IBM, working on dual, quad, and octal core processors. Not to mention the sheer drop in the cost of Memory. I priced 10GB of Ram for a server the other day, $900.00.
Computing hardware is a commodity like no other, as prices drop through the floor and performance is improving ahead of Moore's law.
I think we are in great shape.
Plus there are some kick ass engineers working to make Flash and Python exponentially faster.
Time will tell but I am banking that performance will be a non-issue. Developer productivity is where the money is.
Ted ;)
I think the link should be to python.ORG. python.COM gives you somethink else entirely!!
Fixed. Always good to get URLS right. :)
Actually, i think we are saying the same thing. CPU speed is unlikely to continue to increase as it has in the past. Multi-core CPU's are where we are going to get increases in power. However, in order to realize these increases, the apps need to be able to take advantage of these multi-core CPUs, which means efficent threading of the apps.
As i stated, Python can't multithread right now (the GIL) and Flash's model is also single threaded. Now, i'm hopeful that both the dev's of Python and Flash are going to be working as hard as possible to make these apps work with the new breed of CPUs coming down the pipe.
I will do a high level post on Flash Player performance.
Actually single threaded Flash is a good thing. ;)
ted ;)
I don't know. I think there are places in the flash player that could take advantage of the parallelism offered by new multi-core CPUs.
I'm not so sure that we'd want to introduce the complexity of threads into Actionscript.
Let the complier/VM deal with making things parallel, not the developer.
I use Flash and Python - both are great for RAD. Performance isn't always about CPU or threads or machine level type things. Some of the bottlenecks are in common routines (polygon clipping, collision detection, or 'contains' in geometry). There is a promise of exponential performance enhancements with new smarter algorithms for such tasks - ones that can be rapidly developed and tested in Flash, Python etc - then ported to C++ or whatever. Using these RAD tools I have effectively 5 times more productive time than if I used C++ - I can try things out and find smarter ways of solving problems. (and for that reason I prefer to develop on underclocked PIII than my AMD64 - just as it is easier to get a sense of 'aerodynamics' in a glider than a jetfighter).
There is a way to execute python code in parallel on multi-core CPUs:
Parallel Python
The first commercially viable multi-state quantum computer was unveiled recently. I believe that arguing on whether or not computers will get faster or not is pretty worthless. When one technology tops out, we just make another.
"I use Python and ActionScript extensively in my daily work."
I'd love to know how exactly you use these 2 languages as I'm considering in these exact 2 for quite a while now. Actionscript because of the Flex work that I do and Python because it works so well with the 3d software I use.
Hey Ted, interesting post. I used to do a bit of Java back in University, am AS2 heavy and AS3 bound and have dabbled with Python. It's easy to pick up (like PHP)
It wouldn't surprise me in the slightest if Adobe added threading capabilities to the next generation of Flash post Apollo. They're certainly not shy of adding features.
I reckon it's true that Moores law will hold or the curve will increase but multi-threading coupled with this will create exponential performance leaps.
For a good example of Flash & Python in harmony check out Aral Balkan' GAESWF Google App Engine Python back ended Flash project:
http://gaeswf.appspot.com/
Cheers,
Rob http://www.robmccardle.com
Hi Ted -
I have been looking very wearily at Ruby v Python, and which has a stronger AMF support. A lot of the AS3 guys I know are super into Ruby, but I feel like Python has had more development cycles/more libraries built for it etc.
I found this article when I was looking for some PyAMF solutions, so if you don't mind, I will put some links on here for people in my sitch (Flex folks of 2 to 3 years looking to take control of the whole stack in a non-PHP way):
http://djangoamf.sourceforge.jp/index.php?UserManual_en#AsToPython
http://pyamf.org/
http://www.simonf.com/amfpython/
If there are any other resources you know of, please let me know.
*** if new to this, check out the django AMF link, as it was a good jump start for me***