Open kbigliar opened 5 years ago
Better yet, declare currentDateTime outside the for loop on line 182.
Timing code seen here: https://repl.it/repls/BetterWideCopyright Destructing and rebuilding a datetime runs on average about 4 times as slow as just using a datetime.datetime.now(). Additionally, as you don't care for the microsecond differences in the time, building the datetime for each follower currently increases the overhead about a thousandfold and linearly takes longer the more followers you get.
https://github.com/Ridgure/TwitchBot/blob/28e2a8d164e46c6eaf3cc46a9761fee3e0ea8a25/bot.py#L207-L227 and https://github.com/Ridgure/TwitchBot/blob/28e2a8d164e46c6eaf3cc46a9761fee3e0ea8a25/bot.py#L234-L237
Why not use
currentDateTime = datetime.datetime.now()
?