On Wed, Feb 13, 2013 at 4:02 PM, Amaury Forgeot d'Arc <amaur...@gmail.com> wrote: > 2013/2/13 Lennart Regebro <rege...@gmail.com> >> >> On Wed, Feb 13, 2013 at 3:27 PM, Amaury Forgeot d'Arc >> <amaur...@gmail.com> wrote: >> > Yes, it's jitted. >> >> Admittedly, I have no idea in which cases the JIT kicks in, and what I >> should do to make that happen to make sure I have the best possible >> real-life test cases. > > > PyPy JIT kicks in only after 1000 iterations.
Actually, my test code mixed iterations and string length up when printing the results, so the tests I showed was not 100 iterations with 10.000 long string, but 10.000 iterations with 100 long strings. No matter what the iteration/string length is .format() is the slowest or second slowest of all string concatenation methods I've tried and '%s%s' % just marginally faster. This both on PyPy and CPython and irrespective of string length. I'll stick my neck out and say that using formatting for concatenation is probably an anti-pattern. //Lennart _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com