I dont think that is how script engines work. Both are the same.
First time AFL runs, it will take time to generate some machine code. After that, it will use it and run fast.
If formula isn't changing, it wont make sense to parse on every run.
If either A or B was faster, i'm sure there would have been a KB article on it.
I think TimeNum() is a timestamp array by default(like O,H,L...) but in the case of other functions like RSI(14) for instance the function gets an unique identifier and gets created in the array matrix.
If you reference RSI(14) a million times in the same AFL under the hood it has the same identifier and it points to the same array in the matrix.
I have the impression tn = TimeNum(); will double the timpestamp array, but that is just a guess. If it is so code A is actually worse.
In javascript and other languages I can tell you for sure code A would be faster if TimeNum() was a function.
The reason I ask is I'm new to AFL and want to be careful what I worry about when I write code and make sure I establish good practices from the get go as I want to shorten the learning curve as much as I can.