Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

tanishiking
Copy link
Contributor

Replace js.Function1 with java.util.Function in java.util.RedBlackTree.fromOrdered to eliminate JS interop overhead when constructing the tree from sorted collections (used for TreeMap and TreeSet). According to the micro benchmark: this change provides performance improvements on WebAssembly while maintaining identical performance on JavaScript runtime: tanishiking/scalajs-benchmarks#5

  • 4-5x faster TreeMap/TreeSet construction from SortedMap/Set on Wasm
  • No performance regression on JS

Replace `js.Function1` with `java.util.Function` in `java.util.RedBlackTree.fromOrdered` to eliminate JS interop overhead when constructing the tree from sorted collections (used for TreeMap and TreeSet).
According to the micro benchmark: this change provides performance improvements on WebAssembly while maintaining identical performance on JavaScript runtime:
tanishiking/scalajs-benchmarks#5

- 4-5x faster TreeMap/TreeSet construction from SortedMap/Set on Wasm
- No performance regression on JS
@sjrd sjrd enabled auto-merge August 25, 2025 22:45
@sjrd sjrd merged commit 3a337a8 into scala-js:main Aug 26, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants