Closed
Description
openedon Sep 27, 2022
Description:
Atomics.wait
sets t to either +∞ or a nonnegative mathematical value that may have a fractional component, and if SuspendAgent is invoked it receives that value as its timeout. But timeout is specified to be a non-negative integer, which excludes +∞ and non-integer mathematical values, making the invocation inconsistent.
eshost Output:
Of the implementations that support Atomics.wait
, most appear to respect a fractional component but GraalJS appears to truncate it.
$ eshost -sx '
const { now } = Date;
const arr = new Int32Array(new SharedArrayBuffer(1024));
for (let timeout of [99.999, 100, 100.300, 100.499]) {
const N = 30;
const t0 = now();
for(i = 0; i < N; i++) Atomics.wait(arr, 0, 0, timeout);
const duration = now() - t0;
const totalDelay = duration - timeout * N;
const meanDelay = totalDelay / N;
print(`mean delay ${Math.round(meanDelay * 5) / 5} ms over ${timeout}`);
}
'
#### engine262
ReferenceError: 'SharedArrayBuffer' is not defined
#### GraalJS
mean delay -0.8 ms over 99.999
mean delay 0.2 ms over 100
mean delay 0 ms over 100.3
mean delay -0.2 ms over 100.499
#### JavaScriptCore, SpiderMonkey, V8
mean delay 0.2 ms over 99.999
mean delay 0.2 ms over 100
mean delay 0.2 ms over 100.3
mean delay 0.2 ms over 100.499
#### Moddable XS
TypeError: Atomics.wait: main thread cannot wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment