Skip to content

Workers

namespace Griff.Runtime;
public static class Workers

The threads Griff spreads a big scene’s work over: building a frame of thousands of sprites, and running a crowd of scripts (see CrowdAttribute). Work is split into chunks that the game’s own thread and the workers take in turn, so a slower core (on a CPU with fast and efficient cores) takes fewer. What comes out is the same however many threads there are, one included: they only change how soon it’s done.

public static int Default { get; }

How many threads a game shares its work over unless its host says otherwise (WorkerCount): one for each of the computer’s logical processors, up to 16, and 1 in a browser (the web player has the page’s thread only). The threads themselves are the process’s, shared by every game in it; how many of them a game’s work takes is the game’s.

public static long AllocatedBytes()

The bytes this thread has allocated so far, and the workers have doing its work, all told: what a profiler counts the game’s garbage by (GetAllocatedBytesForCurrentThread would miss what the workers make for it).