Add wasm-based elkjs version using teavm transpilation#376
Draft
Add wasm-based elkjs version using teavm transpilation#376
Conversation
…s-gwt, and elkjs-wasm
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Seeing #372 the other day made me curious what has changed during the last ~8 years regarding transpilation options (also see #103). So I gave teavm a try, and it seems to work with a couple of fixes outlined below.
The package structure, public API, and publishing process likely still need some adjustment before this lands. I didn't really follow what people require nowadays for properly integrating elkjs in their projects.
Results
All 550 eclipse-elk/elk-models json files produce equivalent layout results for elk, elkjs-gwt, and elkjs-wasm (after applying the ELK fix mentioned below).
Speedup of wasm vs gwt seems to be ~3 for my machine and the benchmark setup: slightly higher for smaller models, slightly lower for larger ones.
Required fixes
TLinkedListdoes not implementCloneable, preventingElkReflectfrom properly creating default (mutable) layout option values forKVectorChains, e.g. (I don't know if the omission ofCloneableis on purpose, though),TAbstractList'sTListIteratorbehaved incorrectly. ELK uses iterators frequently to modify lists during iteration (e.g. during crossing minimization).TRandomwasn't sufficiently deterministic when seeded, making results non-deterministic and impossible to compare for equivalence to elkThe teavm points are worked around here by recreating the relevant package locally for the build process. However, it may be worthwhile to address them upstream instead. Either way, great work by teavm!
Further additions