[Python-Dev] PEP 414 - Unicode Literals for Python 3

"Martin v. Löwis" martin at v.loewis.de
Tue Feb 28 10:02:46 CET 2012


Am 27.02.2012 22:35, schrieb Armin Ronacher:
> Hi,
> 
> On 2/27/12 4:44 PM, martin at v.loewis.de wrote:
>> Maybe I'm missing something, but there doesn't seem to be a benchmark
>> that measures the 2to3 performance, supporting the claim that it
>> runs "two orders of magnitude" slower (which I'd interpret as a
>> factor of 100).
> My Jinja2+Werkzeug's testsuite combined takes 2 seconds to run (Werkzeug
> actually takes 3 because it pauses for two seconds in a cache expiration
> test).  2to3 takes 45 seconds to run.  And those are small code bases
> (15K lines combined).

I'm not quite able to reproduce that. I don't know how to run the Jinja2
and Werkzeug test suites combined (Werkzeug's setup.py install gives
SyntaxError on Python3). So taking Jinja2 alone, this is what I get:

- test suite run: 0.86s (python setup.py test)
- 2to3 run: 6.7s (python3 setup.py build, using default:3328e388cb28)

So this is less than a factor of ten, but more importantly, much shorter
than 45s.

I also claim that the example is atypical, in that the test suite
completes so quickly. Taking distribute 0.6.24 as a counter-example:

- test suite run: 9s
- 2to3 run: 7s

So the test suite runs longer than the build process.

Therefore, even a claim "In many cases 2to3 runs 20 times slower than
the testsuite for the library or application it's testing" cannot
be substantiated, as cannot the claim "This for instance is the case for
the Jinja2 library".

On the contrary, I'd expect that the build time using 2to3 is
significantly shorter than the test suite run times, *in particular*
for large projects. For example, for Django, 2to3 takes less than
3 minutes (IIRC), and the test suite runs an hour or so (depending
on how many tests get skipped).

Regards,
Martin


More information about the Python-Dev mailing list