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

Skip to content

Conversation

tanishiking
Copy link
Owner

@tanishiking tanishiking commented Aug 25, 2025

Benchmark Platform main Time (ms) main Std Dev new Time (ms) new Std Dev
TreeMapFillInt100 Scala.js 11.875 0.012 11.010 0.012
TreeMapFillInt1000 Scala.js 115.741 0.124 106.577 0.096
TreeSetFillInt100 Scala.js 16.751 0.013 11.629 0.010
TreeSetFillInt1000 Scala.js 171.296 0.128 117.082 0.107
TreeMapFillInt100 Scala/Wasm 105.447 0.083 17.722 0.023
TreeMapFillInt1000 Scala/Wasm 1033.841 0.710 185.669 0.187
TreeSetFillInt100 Scala/Wasm 110.657 0.080 19.774 0.019
TreeSetFillInt1000 Scala/Wasm 1082.643 0.596 207.534 0.201

tanishiking added a commit to tanishiking/scala-js that referenced this pull request Aug 25, 2025
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
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.

1 participant