[Pkg-javascript-commits] [node-sha.js] 65/237: this tiny change make it 11% faster on 174mb file!

Bastien Roucariès rouca at moszumanska.debian.org
Fri May 5 09:02:59 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-sha.js.

commit f58c3212e40b9c65dc81dcf4765052d4181cf96d
Author: Dominic Tarr <dominic.tarr at gmail.com>
Date:   Mon Dec 30 22:32:20 2013 +0700

    this tiny change make it 11% faster on 174mb file!
---
 sha1.js | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/sha1.js b/sha1.js
index f481b3e..563f14f 100644
--- a/sha1.js
+++ b/sha1.js
@@ -53,9 +53,9 @@ function Sha1 () {
 
 Sha1.prototype._update = function (array) {
 
-  var X = this._dv
-  var H = this._dvH
-  var h32 = this._h32
+  const X = this._dv
+  const H = this._dvH
+  const h32 = this._h32
 
   var h = this._h
   var a, b, c, d, e, _a, _b, _c, _d, _e
@@ -73,15 +73,15 @@ Sha1.prototype._update = function (array) {
 //  console.log(hexpp(x))
 
   for(var j = 0; j < 80; j++) {
-
-    w[j] = j < 16
+    var W = w[j]
+      = j < 16
       ? X.getUint32(j*4, BE)
       : rol(w[j - 3] ^ w[j -  8] ^ w[j - 14] ^ w[j - 16], 1)
 
     var t =
       add(
         add(rol(a, 5), sha1_ft(j, b, c, d)),
-        add(add(e, w[j]), sha1_kt(j))
+        add(add(e, W), sha1_kt(j))
       );
 
     e = d

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-sha.js.git



More information about the Pkg-javascript-commits mailing list