owengombas / discord.ts

🤖 Create your discord bot by using TypeScript and decorators!
https://owencalvin.github.io/discord.ts/
325 stars 40 forks source link

Optimization: Avoid unecessary creations of guards array #60

Closed niekschoemaker closed 3 years ago

niekschoemaker commented 3 years ago

This avoids unecessary memory usage, minor optimization but could add up with many guards and hot paths.

niekschoemaker commented 3 years ago

Added another commit related to linting issues a plugin noticed.

Using await on return values is unecessary as far as I know, unless it's in a try catch block it doesn't change the behavior whatso ever. See: Difference between return await promise and return promise

And the forEach vs map is syntactically more correct, and performance is a bit better.