AlexanderColen / Annie-May-Discord-Bot

Discord bot written in C# for AniList anime/manga lookup.
https://discord.com/oauth2/authorize?client_id=701143398526222386&permissions=388160&scope=bot
13 stars 1 forks source link

Calculating affinity takes really long when there are many users or really big lists. #83

Open AlexanderColen opened 4 years ago

AlexanderColen commented 4 years ago

Two potential bottlenecks, most likely a combination of the two in the end.

Iterating over the lists multiple times, can probably be done more simply. https://github.com/AlexanderColen/Annie-May-Discord-Bot/blob/a22aada92e2cda6208f84f5a79245f1565245e40/Annie/Utility/AffinityUtility.cs#L31-L40 4 GraphQL queries per user really hurts performance the more users are in the server. Quick fix is to move the original user out of this method, which already cuts it down to half. https://github.com/AlexanderColen/Annie-May-Discord-Bot/blob/a22aada92e2cda6208f84f5a79245f1565245e40/Annie/Modules/AffinityModule.cs#L46-L49