This is an automated email from the ASF dual-hosted git repository. jking pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/thrift.git
The following commit(s) were added to refs/heads/master by this push: new c0a5eed THRIFT-4592: change readI32 to use Array.reverse/Array.pop vs Array.shift, which is expensive for big arrays in V8 c0a5eed is described below commit c0a5eed219f1d1d9f8634560489cd541e6ed5d4c Author: Drew Ritter <drew.rit...@mapd.com> AuthorDate: Wed Jun 27 10:28:00 2018 -0700 THRIFT-4592: change readI32 to use Array.reverse/Array.pop vs Array.shift, which is expensive for big arrays in V8 --- lib/js/src/thrift.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/js/src/thrift.js b/lib/js/src/thrift.js index 2b385a3..39e6db1 100644 --- a/lib/js/src/thrift.js +++ b/lib/js/src/thrift.js @@ -1319,7 +1319,11 @@ Thrift.Protocol.prototype = { if (f.length === 0) { r.value = undefined; } else { - r.value = f.shift(); + if (!f.isReversed) { + f.reverse(); + f.isReversed = true; + } + r.value = f.pop(); } } else if (f instanceof Object) { for (var i in f) {