arturo icon indicating copy to clipboard operation
arturo copied to clipboard

[VM/globals] Is there any way to actually avoid them altogether?

Open github-actions[bot] opened this issue 1 year ago • 0 comments

[VM/globals] Is there any way to actually avoid them altogether?

Having all these global variables is practical, but it actually causes problems when we end up wanting to work with multiple threads. An idea would be to add them as fields in a VM object, and pass this object around. But it would still need to be properly benchmark as it would - undoubtedly - add some serious overhead.

https://github.com/arturo-lang/arturo/blob/ce734e7a32c73173910cdf8f533f56be21febe3b/src/vm/globals.nim#L21

#=======================================

# TODO(VM/globals) Is there any way to actually avoid them altogether?
#  Having all these global variables is practical, but it actually causes problems when we end up wanting to work with multiple threads. An idea would be to add them as fields in a VM object, and pass this object around. But it would still need to be properly benchmark as it would - undoubtedly - add some serious overhead.
#  labels: vm, enhancement, benchmark, open discussion

var
    # symbols
    Syms* {.global.}      : ValueDict
ndex 584dd731a..39eb13156 100644
++ b/src/vm/lib.nim

658ca7972fbf6d3830966a03cc9d6c7d9e3ea816

github-actions[bot] avatar Aug 03 '22 11:08 github-actions[bot]