Array vs Uint8Array (ArrayBuffer) (v2)

Revision 2 of this benchmark created on


Setup

const key = 'ab56b4d92b40713acc5af89985d4b786'

Test runner

Ready to run.

Testing in
TestOps/sec
Array
const a = [46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49, 33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13]

const result = []
for (let i = 31; i >= 0; --i) {
    result[i] = key[a[i]]
}
ready
Uint8Array (ArrayBuffer)
const buffer = new ArrayBuffer(32)
const a = new Uint8Array(buffer)
a.set([46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49, 33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13])

const result = []
for (let i = 31; i >= 0; --i) {
    result[i] = key[a[i]]
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.