https://kotlinlang.org logo
#k2-early-adopters
Title
# k2-early-adopters
v

vineethraj49

08/24/2022, 4:36 AM
hey folks; maven shop here,
Did K2 compilation went well?
yep. few minor fixes for type inference (+-10 lines), and having to bump up to 1.7.20-Beta due to this bug but was fine otherwise.
Have you noticed a difference in the build speed?
yep! our biggest module went from 44s to 20s on average so that’s great! overall, we see a ~25% improvement
Or what errors you encountered with, if they happened?
1. aforementioned bug 2.
value?.property
on a definitely non-null
value
was complaining, but am assuming it’s by design, so just fixed it 3. if both
kotlin-stdlib-jdk8
and
kotlin-stdlib-jre8
are somehow on path, the compiler complains about “confusing overloads”. excluding
-jre8
worked.
👍 2
👍🏾 1
d

dmitriy.novozhilov

08/24/2022, 7:47 AM
Cool, thank you for feedback
value?.property
is nullable by design, yes. Existing behavior in K1 compiler is against specification (check KT-46860 for more details) Two different stdlibs is a build issue and it complains by design too: when someone reference class, then compiler chooses first class with that name found in classpath, but when someone reference function, compiler need to find all functions with that name in all dependencies because of overloads. I wonder how it worked for you with K1 compiler
I'm really curios about two modules in your project showed performance degradation. Can you please provide some details about those modules?
s

semoro

08/24/2022, 12:52 PM
Is build can performed on Linux or MacOs? If so could you please download async-profiler Unpack it somewhere you like
Copy code
// Linux only, refer to async-profiler wiki for explanation
sysctl kernel.perf_event_paranoid=1
sysctl kernel.kptr_restrict=0
https://github.com/jvm-profiling-tools/async-profiler/wiki/Basic-Usage And then run kotlin compiler with additional argument of
-Xprofile=<async-profiler-dir-path>/build/libasyncProfiler.so:event=cpu,interval=1ms,threads,start:<output-dir-path>
Note: output-dir must exist beforehand And then provide files
snapshot-*.collapsed
, it only contains JVM/Compiler stack-traces
v

vineethraj49

09/05/2022, 7:36 AM
apologies, was caught up with some other stuff.. @semoro i’ve tried to get this working with maven (multi-module), but I keep getting a
Profiler already started
am only able to get this for individual modules (
-pl module
); as soon as it’s multi-module, or the module includes tests, this stops working.. any suggestions?
s

semoro

09/05/2022, 9:14 AM
You could try to use
-Dmaven.test.skip=true
to avoid compilation of tests It is ok to collect it only for single module Please collect it for that module, which is compiling significantly slower with K2 Also, does this build uses parallel building? If so, please disable it first
21 Views