Search code examples
c#arraysmultithreadingunity-game-enginetextures

Multi threading in unity having hiccups


Here is the code:

https://gist.github.com/badjano/e51d61237b9dde1df74536b1bc0bcbcc

I tried removing locks and some other stuff, but this is as optimized as I could do. Is there any way I can make it smoother?

On my end I set it up for 1024 and 16 threads on the inspector, it was the best performance, for the amount of pixels.

I have no idea why its having those pauses.


Solution

  • Found it, instantiating Data inside the loop was causing the hiccup, so the problem was actually memory allocation overhead

    very smooth now, code updated, mistake in earlier revisions