It’s really not going to affect performance? Because when you don’t store it, you are indexing it all time. Imagine I have a loop using this function, wouldn’t it affect performance by indexing it each run?
In your example you’re not indexing it everytime as you’ve localized the function to the scope of the script. It makes no difference in this case. Even if you were indexing it repeatedly, it would cause negligible difference as long as the module storing the functions wasn’t insanely large where after every index it has to search through a crazy amount of functions.