Hi.
I am trying a simple job to measure how big of a performance improvement I get.
This is the related code:
[BurstCompile]
struct HardJob : IJob
{
public void Execute()
{
for (int i = 0; i < 10000; i++)
{
float result = Mathf.Exp(Mathf.Sqrt(i));
}
}
}
And then I just call it via:
NativeArray<JobHandle> arr = new NativeArray<JobHandle>(10000, Allocator.TempJob);
for (int i = 0; i < 10000; i++)
{
arr *= new HardJob().Schedule();*
}
JobHandle.CompleteAll(arr);
arr.Dispose();
Performance results in the editor are AMAZING:
- Without jobs: 160ms per excecution.
- With Jobs: 16ms per excecution.
- With BURST ™️ jobs: 0.16 ms per execution!
----------
Aaaand then I tried HTML5
- Without jobs: 180ms
- With jobs 190 ms
- With BURST ™️ : 195ms
----------
Why is my HTML5 performance WORSE when using jobs? Did I forget to enable something in the build settings?