If I define a function outside of a job will it still receive the same performance benefits as if it were explicitly written inside Execute() (using Burst compilation)?
I see no reason why calling a method inside a job should break burst compilation.
See Burst User Guide | Package Manager UI website
At “Language Support” it says that it does not support “Any methods related to managed objects (e.g array access…etc.)”
which means, methods which stick to the rules should be fine.
edit: What brings up another question for me, how do you access the method in a valid way?
Are we talking about a static Method? For it to be optimized it would be inlined and yes I think that’s the only case and way it would work. Inlined static methods with no managed objects.
Do they have to be explicitly inlined?
With: [MethodImpl(MethodImplOptions.AggressiveInlining)] ?
I see some methods with or without inlining suggested.
The compiler will compile and optimize everything reachable from the Execute() method and will choose to inline or not depending on optimization opportunities. Inline is overall quite aggressive with burst, so many functions will be inlined.
Not explicitly, no. I meant that it is what burst would probably do as @xoofx confirmed. Also, I now realize that not only static methods are reachable from a job.