3

Does anyone know of a list of functions which are available to call from WebAssembly when running in a modern web browser?

Or perhaps the answer is that there are no such functions except the ones explicitly made available from JavaScript?

Specifically, I would like to know if it is possible to read a clock without the need to write JavaScript that calls Date.getTime() and then call that JavaScript from WebAssembly. My problem with that solution is that I assume doing so would have non-trivial overhead and I would like to read the clock often. Preferably the clock would not be affected by any jump in the local real time clock as I only need to measure the length of time intervals.

1 Answer 1

3

Your guess is correct: there are no specific Wasm functions in a browser. Any JavaScript function with a type that Wasm understands can be directly imported into and called from a Wasm module.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, that is a good point. So I can basically just import a function pointer directly to performance.now() and the browser will have a chance to handle that reasonably efficiently.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.