From f8a6024d9535487c7451c1fff5b896657044eb05 Mon Sep 17 00:00:00 2001 From: MaxGraey Date: Wed, 4 Sep 2019 16:31:19 +0300 Subject: [PATCH] [Loader] Speedup __getArray --- lib/loader/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/loader/index.js b/lib/loader/index.js index 434fb5fed1..6a51c1291b 100644 --- a/lib/loader/index.js +++ b/lib/loader/index.js @@ -199,7 +199,11 @@ function postInstantiate(baseModule, instance) { /** Reads (copies) the values of an array from the module's memory. */ function __getArray(arr) { - return Array.from(__getArrayView(arr)); + const input = __getArrayView(arr); + const len = input.length; + const out = new Array(len); + for (let i = 0; i < len; i++) out[i] = input[i]; + return out; } baseModule.__getArray = __getArray;