d5 / tengo

A fast script language for Go

Home Page:https://tengolang.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

provide compiled.CloneWithoutGlobals() or make compiled's fields accessible

AprilFiv opened this issue · comments

commented

known that what we actually run is
NewVM(c.bytecode, c.globals, c.maxAllocs).Run()
but currently, object Compiled own the globals, and the provided method Clone() is too heavy to create a new instance for the concurrent execution purpose(I don't like object pool).

maybe provide a method CloneWithoutGlobals()(also means no lock) and let the user decide the running variables is better?

or can we simply make compiled's fields accessible, so that I can wrap a more efficient interface?