diff options
author | stephan <stephan@noemail.net> | 2022-12-09 08:44:22 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2022-12-09 08:44:22 +0000 |
commit | 5a83f52f4881aa461ee3b7132892fddb8e20c9b2 (patch) | |
tree | b4744f463db1de96431c37cc457897904576810e /ext/wasm/common/whwasmutil.js | |
parent | a3451dd990aef47590603a9ca610eaa6f7453852 (diff) | |
download | sqlite-5a83f52f4881aa461ee3b7132892fddb8e20c9b2.tar.gz sqlite-5a83f52f4881aa461ee3b7132892fddb8e20c9b2.zip |
Micro-optimization in the oft-activated JS-to-WASM arguments conversion step.
FossilOrigin-Name: ee47e9b83ca668b37dc1d8e519048a635693cf33d9967a2d81ff0824b7eea4ba
Diffstat (limited to 'ext/wasm/common/whwasmutil.js')
-rw-r--r-- | ext/wasm/common/whwasmutil.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/wasm/common/whwasmutil.js b/ext/wasm/common/whwasmutil.js index 3f3281876..9724f03e4 100644 --- a/ext/wasm/common/whwasmutil.js +++ b/ext/wasm/common/whwasmutil.js @@ -1549,18 +1549,19 @@ self.WhWasmUtilInstaller = function(target){ /*Verify the arg type conversions are valid...*/; if(undefined!==resultType && null!==resultType) __xResultAdapterCheck(resultType); argTypes.forEach(__xArgAdapterCheck); + const cxw = cache.xWrap; if(0===xf.length){ // No args to convert, so we can create a simpler wrapper... return (...args)=>(args.length ? __argcMismatch(fname, xf.length) - : cache.xWrap.convertResult(resultType, xf.call(null))); + : cxw.convertResult(resultType, xf.call(null))); } return function(...args){ if(args.length!==xf.length) __argcMismatch(fname, xf.length); const scope = target.scopedAllocPush(); try{ - const rc = xf.apply(null,args.map((v,i)=>cache.xWrap.convertArg(argTypes[i], v))); - return cache.xWrap.convertResult(resultType, rc); + for(const i in args) args[i] = cxw.convertArg(argTypes[i], args[i]); + return cxw.convertResult(resultType, xf.apply(null,args)); }finally{ target.scopedAllocPop(scope); } |