Skip to content

Optimize /castfocus using superwow and memoization and Co-optimize /cast as well via memoization#1610

Open
dsidirop wants to merge 6 commits intoshagu:masterfrom
dsidirop:dsidirop/PF-0029b-optimize-castfocus-using-superwow-and-memoization
Open

Optimize /castfocus using superwow and memoization and Co-optimize /cast as well via memoization#1610
dsidirop wants to merge 6 commits intoshagu:masterfrom
dsidirop:dsidirop/PF-0029b-optimize-castfocus-using-superwow-and-memoization

Conversation

@dsidirop
Copy link
Contributor

@dsidirop dsidirop commented Feb 15, 2026

  • Add support for superwow-aware SlashCmdList.PFCASTFOCUS() just like we did with SlashCmdList.PFFOCUS

This allows us to employ unit-guid-targeting to side-step the complex target-swapping tricks we would resort to when superwow wasn't available.

This is a much more care-free and lightweight approach.

  • Replace loadstring() calls in _G.SlashCmdList.PFCAST() and SlashCmdList.PFCASTFOCUS() with the new pfUI.api.TryMemoizedFuncLoadstringForSpellCasts() to enjoy better runtime performance when the user passes lua-func-strings (considering that they're the same strings time and over again).

As an added bonus this commit also adds seamless support for passing actual raw functions to SlashCmdList.PFCASTFOCUS() ala:

SlashCmdList.PFCASTFOCUS(function() CastspellByName("Renew" .. desiredRank); end)

This is extremely useful for advanced pure-lua macros (p.e. via SuperMacro) as it simplifies the invocation-style tremendously.

Old was: Before this commit we would have to write this kind of stuff as a string

SlashCmdList.PFCASTFOCUS( 'function() CastspellByName("Renew"' .. desiredRank .. '); end' )  -- notice we had to use a "string-function" here!

This was both 10x slower and was extremely cumbersome and error-prone for the user if he wanted to pass some variable-state inside the string-func-callback (god help him in that case!)

…fUI.api.RunOOC() to resolve some static-analysis warnings about var-names
…ich is meant to be used in order to memoize lua-func-strings passed on to various spell-casting utilities in the next few commits (/pfcast, /castfocus etc)
…STFOCUS() just like we did with SlashCmdList.PFFOCUS
…alls in _G.SlashCmdList.PFCAST() and SlashCmdList.PFCASTFOCUS() with pfUI.api.TryMemoizedFuncLoadstringForSpellCasts() to enjoy better runtime performance when the user passes a lua-func-string
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 this pull request may close these issues.

1 participant