private (long mainTicks, long jobTicks) MainThreadPerformanceTest(AnimationCurve ac, int iterationCount) { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); var jac = new JobAnimationCurve(ac, Allocator.Temp); float[] evaluated = new float[iterationCount]; sw.Start(); for (int i = 0; i < evaluated.Length; i++) { evaluated[i] = jac.Evaluate(i / (float)iterationCount); } sw.Stop(); var jobTicks = sw.ElapsedTicks; sw.Reset(); sw.Start(); for (int i = 0; i < evaluated.Length; i++) { evaluated[i] = ac.Evaluate(i / (float)iterationCount); } sw.Stop(); var mainTicks = sw.ElapsedTicks; jac.Dispose(); return(mainTicks, jobTicks); }
public void Execute(int index) { evaluated[index] = jobAnimationCurve.Evaluate(index / (float)evaluated.Length); }