bastisawesome / guessinggame_ttv

A Twitch bot to play a word guessing game
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Replace string concatenation #37

Open bastisawesome opened 1 year ago

bastisawesome commented 1 year ago

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.

bastisawesome commented 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:

This 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.

bastisawesome commented 3 months ago

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.