Open justecorruptio opened 9 years ago
Instead of repeatedly concating strings, could you try using cStringIO/BytesIO (Python 2/3)?
Additionally, from looking through the change, it seems you've mixed this performance tweak in with some other changes. I'd rather approach each change separately so we can evaluate what affects they may have. Specifically the change in order to pick()
and __call__
to callable
.
I can pull the other changes not related to concats to a separate PR, although they're both changes that affect performance.
cStringIO is still slower :-/
OK, I've reverted the the call -> callable and pick() order changes for now.
@wbond @isaacdd would you consider merging this if conflicts are fixed?
Theoretically, appending to lists and the joining and the end should be faster; but empirically, we've found that just doing string concats is actually faster anywhere from 2x to 5x depending on the template.