Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Talents.Npc_FindByID to stop on first occurence of ID #31

Closed
kirides opened this issue Jun 25, 2021 · 2 comments · Fixed by #32
Closed

Improve Talents.Npc_FindByID to stop on first occurence of ID #31

kirides opened this issue Jun 25, 2021 · 2 comments · Fixed by #32

Comments

@kirides
Copy link
Contributor

kirides commented Jun 25, 2021

Currently Npc_FindByID looks at every single NPC to find a specific talent id, even if the found id (which should be unique) is found after just a few iterations.

I propose we alter the code for Npc_FindByID to stop iterating as soon as we found the first matching NPC with said ID.

grafik

Before the change, every single buff that would use Buff_GetNpc would look at > 700 NPCs, even though just 10-15 iterations (optimally) were enough.

That, combined with having skills that target multiple NPCs (e.g. Firerain proccing many buffs, each summoned creature having a buff) could previously lead to significant stutter.

In a test on my machine, this code improved the performance for 24 summons (3x army of darkness, all summoned creatures having a buff that uses Buff_GetNpc) from 40-45 FPS and stuttering every 1000ms, to 55-60 fps and no stuttering.

@Lehona
Copy link
Owner

Lehona commented Jun 25, 2021

That's an embarrassing oversight by me, would you be so kind and create a PR? :)

@kirides
Copy link
Contributor Author

kirides commented Jun 25, 2021

Sure, would you want the proposed change, or remove the function calls alltogether and combine it all into one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants