Closed ldelelis closed 4 years ago
From the enmap docs:
Very Fast: Since Enmap resides in memory, accessing its data is blazing fast (as fast as Map() is). Even with persistence, Enmap still only accesses data from memory so you get it almost instantly.
@Known-As-Dan cc @tadeokondrak
Fair enough. Even so, is it a good idea to do a lookup every single message, considering the prefix isn't something that changes on runtime?
@Idelelis Just not sure it's worthwhile, considering the likely small performance improvement. I'd say implement it if you think it'd make a "big-picture" kind of difference.
Nah, no noticeable performance changes will be gained from this. And even as an aesthetic change it's not justified, given that we may implement runtime configuration of prefix in the future. Closing this.
https://github.com/nixnest/scepter/blob/f61a8242d56e8ab7b37428e60f81f2c991861e08/scepter.ts#L229
Baseless and unmeasured supposition, but hitting the db with every message the bot sees could be heavily bogging down its performance.
Handle this by caching in-memory a map with guild-id => prefix, and a function that accomplishes the following.