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.
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.
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.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.