Code that ought to run fast, but can't due to Python limitations.
stefan_ml at behnel.de
Sun Jul 5 13:23:23 CEST 2009
Paul Rubin wrote:
> Stefan Behnel writes:
>> You may notice that the creation of this exact tuple appears in almost all
>> if the conditionals of this method. So it is part of the bottleneck.
> I don't think so. The tuple is only created when the character has
> already matched, and for the vast majority of the chars in the input
> stream (ordinary text chars rather than html delimiters) none of them
Well, it's the second thing that happens when entering the method, it
happens several times later on when specific characters are matched, and it
also happens at the end when none of the special characters did match. So
it /is/ part of the bottleneck because the dict lookups, the tuple
creation, the "in" test and the tuple deallocation happen *twice* for
almost all characters in the stream.
More information about the Python-list