Wolfgang Maier added the comment: > Hum, python3 looks faster on this dummy microbenchmark yeah. Who said that > Python 3 is slower? :-)
If you're alluding to that seemingly endless thread over on python-list, let me say that it is not my motivation to start anything like that here. Sorry also if I sort of hijacked your documentation issue with my performance question. I really only wondered whether there would be any argument for or against any of the two versions (%-interpolation, format-based) other than stylistic ones. That's why I ran the micro-benchmark and, in fact, I was expecting %-interpolation to be faster exactly because it is less flexible. What I am surprised by is not the fact that %-interpolation got faster in Python3, but the fact that format didn't. I was wondering whether %-interpolation maybe takes some fast path in Python3 that simply wasn't implemented for format. If that was the case it could have been rewarding to just optimize format the same way. As I know Victor is working on performance stuff I thought I'd just ask here, but from your answer I gather that things are rather not so simple and that's ok. > I wrote a first article to explain my work on optimization: https://haypo.github.io/pybyteswriter.html Thanks for the link. > str.format(args) was also optimized, but it's still faster than str%args. You mean slower I assume ? > Hum, I don't recall why you started to talk about performance :-D See above. > Why not documenting "%x" % value *and* format(value, 'x')? > I prefer "%x" % value. I never use format(value, ...) but sometimes I use > "{0:x}".format(value). I prefer the last version, use the first sometimes, but documenting several ways seems reasonable. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26506> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com