Optimize control-flow analysis by use of persistent maps
The case that it's worth to optimize is functions with a lot of variables. After debugging it's recovered that control-flow works nearly O(n * m) where n is pseudocode size and m is a number of variables: the algorithm performs O(n) copies of hashmap of size O(m) Persistent maps should help because we don't need to perform a copy of them, so the expected performance after the change is applied is O(n log m) We've tried pcollections and javaslang, and the latter one has demonstrated better results See results before and after optimizations before: https://github.com/dzharkov/kotlin-compiler-benchmarks/blob/3da7ba45a704969653d70b50995f730e968540d8/reports/benchmarks-many-vars-2017-03-14.txt after with pcollections: https://github.com/dzharkov/kotlin-compiler-benchmarks/blob/3da7ba45a704969653d70b50995f730e968540d8/reports/benchmarks-many-vars-persistent-optimizations-2017-03-17.txt after with javaslang: https://github.com/dzharkov/kotlin-compiler-benchmarks/blob/d22a871b175b291fb337b51ef6465ba70bbfd96c/reports/benchmarks-many-vars-javaslang-2017-04-07.txt
This commit is contained in:
@@ -236,6 +236,9 @@
|
||||
<!-- Rhino -->
|
||||
<get-maven-library prefix="org/mozilla" lib="rhino" version="1.7.6"/>
|
||||
|
||||
<!-- Javaslang -->
|
||||
<get-maven-library prefix="io/javaslang" lib="javaslang" version="2.0.6"/>
|
||||
|
||||
<!-- Uast -->
|
||||
<property name="uast.server" value="http://dl.bintray.com/kotlin/uast"/>
|
||||
<get-maven-library prefix="org/jetbrains/uast" lib="uast-common" version="${uast.version}" target.jar.name.base="uast-common" server="${uast.server}"/>
|
||||
|
||||
Reference in New Issue
Block a user