Open bastisawesome opened 1 year ago
Before working on this, might be best to benchmark the two possible solutions and see which one produces consistently better results, or even if there's a non-negligible difference.
Testing should be relatively simple:
StringIO
logicThis may turn out to be premature optimisation and, if it's even worthwhile, might be pushed back to a later release, unless someone else wants to take over and submit a PR. If the metrics don't seem to impact performance in any meaningful way, this may just be scrapped.
Moving this out of the 1.1.0 release. Reason: this assumes a performance penalty that may be a micro-optimisation. A much better solution would be to actually profile the code and see if this is a worthwhile endeavour. Issue will remain open just in case.
Currently some of the codebase uses the string concatenation operator, which creates string copies and unnecessary memory and CPU usage. Replace string concatenation, where possible, with
io.StringIO
instead.