[Tutor] Trying to parse a HUGE(1gb) xml file in python

Stefan Behnel stefan_ml at behnel.de
Tue Dec 21 10:34:23 CET 2010

David Hutto, 21.12.2010 10:19:
> On Tue, Dec 21, 2010 at 4:17 AM, David Hutto wrote:
>> On Tue, Dec 21, 2010 at 4:10 AM, Stefan Behnel wrote:
>>>>> Note that it's not unlikely that this is actually *slower* than using a
>>>>> real XML parser:
>>>> Or a 'real' language like C or C++ maybe to increase, or in Python's
>>>> case, bypass, the interpreter?
>>> While this may be a little faster than Python code (although I suspect that
>>> benchmarking is needed to prove either way), I doubt that it's worth the
>>> overhead in code writing. If I can write a couple of lines of Python code
>>> that are easy to validate and almost as fast as C code, why would I want to
>>> write and debug hundreds of lines of code in C or C++, just to see that I
>>> need to tune my benchmark to notice the difference?
>> Don't get me wrong, I love the simplicity too, but if you know you
>> really do need it along the way, then you should start thinking ahead
>> of the easy, and toward the harder code for your project. Just as
>> every language has it's place, so does Python.

Premature optimisation is the root of all evil. That totally applies when 
choosing a programming language.

> If I want to write a programming language, It might not be the best
> idea to have a labguage needed for speed based on Python, I should
> maybe use wha it's based on, or refine my own optimizations, just to
> be a little clearer about my perspective.

Being clearer would certainly help in understanding your postings.


More information about the Tutor mailing list