Closed cosmicexplorer closed 4 years ago
We would probably need to have some form of benchmarking harness set up that I don't think we currently have in order to evaluate potential perf bumps like this (and if this did exist, it would be a great way to convince people that the migration to python 3 is really deeply worth spending more time on).
I was planning on writing a script that automates the conversion. Beyond perf gains, it's simply more readable and concise.
Script will be how I've written scripts for things like converting set() to set comprehensions, i.e. script will generate the proposed change and then human still has to review it and sign off on it. Should help to catch edge cases.
FYI @asherf found https://github.com/ikamensh/flynt to automate this all!
This has been mostly done thanks to several PRs from Asher.
Python 3 describes a more hygienic form of string templating known as f-strings. This is also more performant, some of which is described in this blog post. This seems like something that can be done incrementally once pants supports python 3 -- it's not clear if there are any cases where this is a big perf win yet, but I suspect they do exist in this codebase.