https://kotlinlang.org logo
Title
k

karelpeeters

12/22/2017, 7:53 AM
Still strange, I can't really think of something that could cause it to take this long. It's not like your system is overloaded right? Or that something is taking up all disk reads?
g

gildor

12/22/2017, 8:02 AM
Yes, it’s classloading
k

karelpeeters

12/22/2017, 8:03 AM
Probably, but a second for a couple of classes? Maybe the reflection package is larger than I thought.
g

gildor

12/22/2017, 8:05 AM
a couple of classes? reflection library is about 2mb
also it’s about 300ms for me
k

karelpeeters

12/22/2017, 8:05 AM
Ah, that's fair.
c

Czar

12/22/2017, 8:07 AM
So, in the commens of the original post we've determined that 300ms is only on first execution in REPL, afterwards no matter what you change all subsequent executions are in realm of 10-15ms, so it can be safely assumed first time is due to REPL init.
k

karelpeeters

12/22/2017, 8:08 AM
Well he's probably not running it in the REPL.
g

gildor

12/22/2017, 8:10 AM
first time is due to REPL init
I reproduced it on pure Kotlin JVM project + gradle run, so it’s not related to REPL itself
c

Czar

12/22/2017, 8:18 AM
Still cold start though
o

Olekss

12/22/2017, 8:24 AM
I am running with normal RUN
but yes... it's cold-start startup
In reality I wanted to write couple of lines of generic code where you give 2 classes, target class and depednecy graph... and it simply traverses all props of target class and matches same-name, assignable-type props from graph class and assigns them from graph to target... and noticed that exactly this first stuff does the evil 🙂
j

jstuyts-squins

12/22/2017, 9:51 AM
I noticed the delay too. It is definitely the initialization of the reflection library. It is heavier than you would expect. I don't have time today to show it with a performance profile though. Hopefully the reflection library initialization performance will be improved in the future
h

hho

12/22/2017, 9:59 AM
Are you on Windows? Most antivirus tools take a really long time to scan JARs.
j

jstuyts-squins

12/22/2017, 11:41 AM
Yep, Windows. I have excluded lots of directories (project, Gradle, IntelliJ IDEA) from scanning, but even then it is noticeable