When should I make a custom blueprint BlueprintPure?
I was first thinking all blueprints that just return data should be pure, but some of these blueprints are somewhat performance intensive (think encryption/decryption or sorting arrays for example).
The result of a pure blueprint isn’t cached right? So won’t it be better to make it callable then, to prevent the performance intensive calculations to be done multiple times unintentionally?
But when it is callable it also uses memory which won’t ever get cleared (and at best gets replaced by smaller output), right?
What is better for performance intensive calculations, callable or pure?
This is very dependent on the situation, although if you’re concerned about performance, caching a variable is often preferable to recalculating something when re-used often within scope.
I try to manage the best of both worlds by naming my getters that might hint at the complexity. For example, a getter that does very little would be **pure **and called ‘GetSomething’, while one that was more complex I would make pure but called ‘CalculateSomething’. So if I use something called CalculateSomething more than once in a function, I would cache it. This especially comes in handy when using const methods in C++ (they automatically become ‘pure’ - I don’t think that can be avoided(?)).
Unless you’re seeing performance issues or your function is especially taxing, this may be over-thinking it imo