Python is faster than C

Joe Mason joe at notcharles.ca
Mon Apr 5 12:33:08 EDT 2004


In article <36wn05qkeyk.fsf at hundertwasser.ti.uni-mannheim.de>, Matthias wrote:
> Isn't the whole idea of very high level languages to shift complexity
> from the user code to the language implementation?  

Yes, but there's always a tradeoff to be made.  Going through
contortions in the VM to make user code only slightly simpler isn't
worthwhile.  Neither is going through contortions to optimize an
extremely rare bit of user code.

Also, a big part of keeping user code simple is making the language
conceptually simple.  If lots of optimizations are done behind the
user's back, it can be confusing to remember which operations are
already optimized.

Take the example of storing large lists as a small pattern and a
repetition counter.  I'd argue that this is hard to get right at the VM
level because you need to consider lots of cases - it's much easier for
the user who knows exactly what patterns need to be optimized.  I also
doubt it will come up too often.  Finally, a user might assume the
optimization is more powerful than it is - for instance, noticing that
huge lists of repeating numbers magically take little memory, they might
fill a huge list in randomly and assume it will work.

Joe



More information about the Python-list mailing list