Documentation
¶
Overview ¶
Command multi-script demonstrates a thread-safe runtime that runs MANY Lua scripts from MANY goroutines, addressing two concerns the simpler bytecode-cache / pool-preload examples leave open:
Concern 1 (concurrent compile): even when many goroutines request the same
script for the first time at once, it compiles exactly once
(per-key sync.Once), while different scripts compile in parallel
(the global lock is held only for the map lookup).
Concern 2 (GC vs Pool): VM pooling is offered in two strategies — sync.Pool
(GC may reclaim) and a fixed channel pool (persistent, predictable
memory).
Engine: lua-pure (github.com/htcom-code/lua-pure).
Click to show internal directories.
Click to hide internal directories.