summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-05 18:05:02 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-05 18:05:02 +1000
commitc7b6fa63459d411cd7b20ea0de3dc2f4cf7e2a2f (patch)
tree9fee378f33aae9941e9ca8b80ac0ba57d01ab0cb
parentf6a4dcf3871c6c5a4f9bdbfe699042dddbb8a62a (diff)
downloadfengari-c7b6fa63459d411cd7b20ea0de3dc2f4cf7e2a2f.tar.gz
fengari-c7b6fa63459d411cd7b20ea0de3dc2f4cf7e2a2f.tar.bz2
fengari-c7b6fa63459d411cd7b20ea0de3dc2f4cf7e2a2f.zip
src/lvm.js: Optimise variable declarations
Oddly 'const' on OCi helps, but on anything else dramatically increases runtime Otherwise the reduced scope for other variables is a tiny bit faster
-rw-r--r--src/lvm.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/lvm.js b/src/lvm.js
index 7c827a8..41b17c8 100644
--- a/src/lvm.js
+++ b/src/lvm.js
@@ -98,28 +98,26 @@ const RKC = function(L, base, k, i) {
};
const luaV_execute = function(L) {
- let OCi = OC.OpCodesI;
+ const OCi = OC.OpCodesI;
let ci = L.ci;
- let opcode, k, base, i, ra;
- var cl;
ci.callstatus |= lstate.CIST_FRESH;
newframe:
for (;;) {
assert(ci === L.ci);
- cl = ci.func.value;
- k = cl.p.k;
- base = ci.l_base;
+ let cl = ci.func.value;
+ let k = cl.p.k;
+ let base = ci.l_base;
- i = ci.l_savedpc[ci.pcOff++];
+ let i = ci.l_savedpc[ci.pcOff++];
if (L.hookmask & (defs.LUA_MASKLINE | defs.LUA_MASKCOUNT)) {
ldebug.luaG_traceexec(L);
base = ci.l_base;
}
- ra = RA(L, base, i);
- opcode = i.opcode;
+ let ra = RA(L, base, i);
+ let opcode = i.opcode;
if (i.breakpoint) // TODO: remove, used until lapi
return;