cyber icon indicating copy to clipboard operation
cyber copied to clipboard

Make static variables thread-local

Open dumblob opened this issue 2 years ago • 2 comments

In response to https://github.com/fubark/cyber/issues/11#issuecomment-1408977386 I wonder if making static variables thread-local would serve the purpose they do now with the great benefit of being safe and fast for multithreading?

Related: https://github.com/fubark/cyber/commit/0d800438baf11e074540be5c1429060d0667420a

dumblob avatar Jan 30 '23 21:01 dumblob

Does this add overhead for single threaded use case? I'm also not clear about how Cyber will do threading at both the script level and embedded level, so this is not urgent.

fubark avatar Feb 04 '23 20:02 fubark

It should not add basically any overhead. Nim uses only thread-local variables everywhere and Nim's peformance is equal to C in single-threaded.

dumblob avatar Feb 04 '23 21:02 dumblob