string repr in 2.1

Robin Becker robin at jessikat.fsnet.co.uk
Tue May 29 11:44:39 EDT 2001


In article <WuQEcgAmO6E7EwUM at jessikat.demon.co.uk>, Robin Becker <robin at jessikat.fsnet.co.uk>
writes
>In article <m3wv7071qs.fsf at atrus.jesus.cam.ac.uk>, Michael Hudson
><mwh at python.net> writes
>
>Yes I figure that getting into C should save me about 50% of the string
>thing. Really need only one pass over the text.
well I added an accelerated version and that runs in 25% of the time needed by the repr
approach

the timings are roughly
Time for 10000x4 uses of <function _escape20 at 007FB9E4> = 1.84" Andy's < Python 2.1
Time for 10000x4 uses of <function _escape21 at 007EA91C> = 8.47" Robin's effort
Time for 10000x4 uses of <function quote_ps_string at 0080CF84> = 3.75" Bernhard's
Time for 10000x4 uses of <function _escapeLambda0 at 0080CFB4> = 2.97" Michael's
Time for 10000x4 uses of <built-in function _instanceEscapePDF> = 0.40" Robin's C extension

so I will code
        if extension: extension
        elif version<2.1: Andy
        else: Mike

-- 
Robin Becker



More information about the Python-list mailing list