Turbine: fast-path simple class types and empty type parameters in TypeBinder. TypeBinder previously flattened every Tree.ClassTy via t.flatten() and bindClassTyRest (allocating two ImmutableLists even for unqualified simple type names), and unconditionally appended empty MapScope wrappers to CompoundScope and invoked bindTyParams (allocating a LinkedHashMap) for every class and method even when typarams().isEmpty(). Fast-path single-identifier class type binding in TypeBinder.bindClassTy when t.base().isEmpty(), avoiding t.flatten() and intermediate list allocations for unqualified type names. Skip appending an empty MapScope to CompoundScope and calling bindTyParams in TypeBinder.bind and TypeBinder.bindMethod when typarams().isEmpty(), shortening the CompoundScope chain traversed by subsequent scope.lookup calls. Fast-path TypeBinder.bindAnnotations when trees.isEmpty() and pre-size the ImmutableList builder when annotations are present. On Chromium’s chrome_java target (1,752 source files, 4,565 classes), running on the JVM (-Xms6g -Xmx6g -Xmn5g -XX:+UseParallelGC, 15 warmup + 15 measured iterations), this reduces TypeBinder phase time by 17.75 ± 3.77 ms (25.3%; 95% CI 20.0–30.7%), from 70.06 ± 3.54 ms (median 71.63 ms) to 52.31 ± 1.29 ms (median 53.18 ms). The output is byte-for-byte identical. PiperOrigin-RevId: 1007456988
Turbine: fast-path simple class types and empty type parameters in TypeBinder.
TypeBinder previously flattened every Tree.ClassTy via t.flatten() and bindClassTyRest (allocating two ImmutableLists even for unqualified simple type names), and unconditionally appended empty MapScope wrappers to CompoundScope and invoked bindTyParams (allocating a LinkedHashMap) for every class and method even when typarams().isEmpty().
TypeBinder
Tree.ClassTy
t.flatten()
bindClassTyRest
ImmutableList
MapScope
CompoundScope
bindTyParams
LinkedHashMap
typarams().isEmpty()
TypeBinder.bindClassTy
t.base().isEmpty()
TypeBinder.bind
TypeBinder.bindMethod
scope.lookup
TypeBinder.bindAnnotations
trees.isEmpty()
On Chromium’s chrome_java target (1,752 source files, 4,565 classes), running on the JVM (-Xms6g -Xmx6g -Xmn5g -XX:+UseParallelGC, 15 warmup + 15 measured iterations), this reduces TypeBinder phase time by 17.75 ± 3.77 ms (25.3%; 95% CI 20.0–30.7%), from 70.06 ± 3.54 ms (median 71.63 ms) to 52.31 ± 1.29 ms (median 53.18 ms). The output is byte-for-byte identical.
chrome_java
-Xms6g -Xmx6g -Xmn5g -XX:+UseParallelGC
PiperOrigin-RevId: 1007456988
Turbine is a header compiler for Java.
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802047560号
Turbine
Turbine is a header compiler for Java.