W3C home > Mailing lists > Public > public-webapps@w3.org > October to December 2010

Re: Hash functions

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 22 Dec 2010 18:48:56 -0500
Message-ID: <4D128E68.3010500@mit.edu>
To: Charles Pritchard <chuck@visc.us>
CC: "Tab Atkins Jr." <jackalmage@gmail.com>, Glenn Maynard <glenn@zewt.org>, public-webapps@w3.org
On 12/22/10 4:39 PM, Charles Pritchard wrote:
> It'd be nice to see an SHA1 JS test case setup for performance testing
> using recent APIs like ArrayBuffer.

Attached.  It uses a 16MB string as input.  I got the JS code off 
http://www.webtoolkit.info/javascript-sha1.html in case it matters.  I 
have no idea whether it's correct.

The SHA1 function is the original one.  The SHA1arr function uses typed 
arrays.  I do verify that the two return the same hash, just to make 
sure things are sane that way.

Note that there's still a bunch of inefficiency here for the "checksum a 
file" use case (e.g. the input is assumed to be a string and converted 
to a byte buffer by encoding the string as UTF-8).

My measurements show that the array version is about 2x faster than the 
string version in this case in both Firefox 4 and Google 10 dev.

Of course the string version in Firefox is about 2x faster than the 
array version in Chrome.  ;)

I know we definitely have more headroom in spidermonkey here.  Which is 
good, because even the array version in spidermonkey is a good bit 
slower than a C app.


Received on Wednesday, 22 December 2010 23:49:35 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:14 UTC