Atomic add

Benchmark created on


Description

use Atomics.add()

Setup

var sab = new ArrayBuffer(1024);
var ta32 = new Uint32Array(sab);
var ta16 = new Uint16Array(sab);
var count = 10_000
var num = 0;

Teardown

num = 0;

Test runner

Ready to run.

Testing in
TestOps/sec
Normal add
for (let i = 0; i < count; i++) {
num++;
}
ready
Atomic add Uint32
for (let i = 0; i < count; i++) {
Atomics.add(ta32, 0, 1);
}
ready
Atomic add Uint16
for (let i = 0; i < count; i++) {
Atomics.add(ta16, 0, 1);
}
ready

Revisions

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