During a DreamScripts record-loader optimization pass, a GMST value reported a numeric semantic type. It was tempting to skip an intermediate tostring conversion before numeric handling.
Commit 3523eaf tried exactly that.
Seconds later, 39ba4b1 reverted it.
Then 1e3bbc4 recorded the actual finding:
GMST values are userdata so sadly no optimization opportunities here
The rule
Do not infer runtime representation from semantic meaning.
A value can represent a number while still arriving through userdata or another wrapper that requires conversion.
Before removing conversions from engine/plugin data:
- inspect
type(value); - inspect the binding/API contract;
- test representative values;
- benchmark only after correctness is established.
This is one of the cleanest examples of why CHECK: commits are useful. The hypothesis was cheap to test, cheap to revert, and left behind a durable fact.
Implementation at the relevant revision: recordReader.lua at 1e3bbc4. The current code is the useful comparison point; the pinned file is the evidence for what the investigation actually changed.
Sources: DreamScripts commits 3523eaf, 39ba4b1, and 1e3bbc4.