Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
sha1-js-rusha-vs-native-10mb
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:140.0) Gecko/20100101 Firefox/140.0
Browser:
Firefox 140
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
10 months ago
Test name
Executions per second
rusha
27.5 Ops/sec
native
493.6 Ops/sec
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/rusha@0.8.14/dist/rusha.min.js"></script>
Script Preparation code:
var data = new Uint32Array(10*1024*1024); var dataBuffer = new Uint8Array(data); // src: https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest function hex(buffer) { var hexCodes = []; var view = new DataView(buffer); for (var i = 0; i < view.byteLength; i += 4) { // Using getUint32 reduces the number of iterations needed (we process 4 bytes each time) var value = view.getUint32(i) // toString(16) will give the hex representation of the number without padding var stringValue = value.toString(16) // We use concatenation and slice for padding var padding = '00000000' var paddedValue = (padding + stringValue).slice(-padding.length) hexCodes.push(paddedValue); } // Join all the hex strings into one return hexCodes.join(""); }
Tests:
rusha
Rusha.createHash().update(dataBuffer).digest('hex');
native
crypto.subtle.digest("SHA-1", dataBuffer ).then(function (hash) {console.log(hex(hash));});