Single Threaded Builds

Zig has a compile option --single-threaded which has the following effects:

  • All Thread Local Variables are treated as Global Variables.
  • The overhead of Coroutines becomes equivalent to function call overhead. TODO: please note this will not be implemented until the upcoming Coroutine Rewrite
  • The @import("builtin").single_threaded becomes true and therefore various userland APIs which read this variable become more efficient. For example std.Mutex becomes an empty data structure and all of its functions become no-ops.