forked from ocaml-wasm/wasm_of_ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Have physical equality inspect Javascript objects
Currently in wasm, physical equality behaves differently from in Javascript: Javascript objects are boxed, and non-equality of the pointers causes the values to be physically not equal. This can be an issue for some folks who rely on the JS-object-inspecting semantics of physical equality to implement things such as memoizing. This restores the fact that physical equality inspects Javascript objects. Other values are unaffected. This entails to pay an additional cost of between one and two Wasm runtime type tests in physical equality. A quick benchmark performing a few million `(==)` in an array of integers show a slowdown of 20~25 %. Since typical programs should perform physical equality much less frequently, we expect the overhead to be in the noise in practice. That being said, we may want to make this behaviour opt-in using a flag. Co-authored-by: Jérôme Vouillon <[email protected]>
- Loading branch information
1 parent
5741b98
commit 0e3a704
Showing
6 changed files
with
87 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters