Per the documentation I know you can put a “[BurstCompile]” tag prior to the definition a struct that inherits from a Job interface.
A few questions:
Where else can I put the “[BurstCompile]” tag?
For instance if I create an extension type static class in order to re-use code across different jobs can I use the burst compile tag on the static class or the individual functions in the static class?
What if it isn’t an extension class just a static class with functions. Does burst work with that?
Does burst speed things up on the main thread too or is it only non-main thread jobs where it works.
Not required, if those static methods are used inside a burst job they’ll be burst compiled for that job.
You can put the [BurstCompile] tag on methods if you are using burst compiling a delegate.
Jobs can run on main thread and will do so if the thread is locked waiting on a job chain, but burst only works on jobs (and burst compiled delegates).
I am somewhat confused then because I have a situation where I have a burstcompiled job that has a function that calls a static function outside of the job. Inside that function I call a Mathf function. I was under the impression that Mathf was not burst compatible. Since I got no complains I was assuming that the static function call was not getting compiled.
You need Unity.Mathematics inside the iJob to properly enable Burst. I did a test with regular Vector3s, Mathf, etc. on an iJobParallelFor and it didn’t give me as good of a performance boost as when I redid it all using Unity.Mathematics including float* instead of Vector*.