aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-05-16 18:05:17 +1000
committerdaurnimator <quae@daurnimator.com>2017-05-16 18:09:40 +1000
commit32bb4b116bab3df193f1ca1db022c217bd5f2cda (patch)
treecf0cf021bef1bbde93390a7e956d93a4bb819b17
parent080bb741b521ec8ff472ca239003b43860315c9a (diff)
downloadfengari-32bb4b116bab3df193f1ca1db022c217bd5f2cda.tar.gz
fengari-32bb4b116bab3df193f1ca1db022c217bd5f2cda.tar.bz2
fengari-32bb4b116bab3df193f1ca1db022c217bd5f2cda.zip
src/lvm.js: Optimization in luaV_equalobj
-rw-r--r--src/lvm.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lvm.js b/src/lvm.js
index 5abf61e..df4f62f 100644
--- a/src/lvm.js
+++ b/src/lvm.js
@@ -713,8 +713,8 @@ const luaV_equalobj = function(L, t1, t2) {
if (t1.ttnov() !== t2.ttnov() || t1.ttnov() !== CT.LUA_TNUMBER)
return 0; /* only numbers can be equal with different variants */
else { /* two numbers with different variants */
- let i1, i2; /* compare them as integers */
- return (((i1 = luaV_tointeger(t1, 0)) !== false) && ((i2 = luaV_tointeger(t2, 0)) !== false) && (i1 === i2)) ? 1 : 0;
+ /* OPTIMIZATION: instead of calling luaV_tointeger we can just let JS do the comparison */
+ return (t1.value === t2.value) ? 1 : 0;
}
}