The controller coding in kotlin hangs for 1 or more minutes after intensive database operation


#1

Recently I am attracted by kotlin simple grammar and lamda. In the back-end module in some of the spring controllers coding with kotlin, I found that after intensive database operation, the controller will hang for a minute or a few minutes before they can run further (both debug and release perform same). Did not code this module for java and kotlin to contrast (mainly feel that the workload is a bit big), but looks like never encountered with the previous controllers coding in java. A little worried about the efficiency of kotlin in lamda expression processing, it is easy for developers to overuse lamda that may lead to inefficiency. My project uses the kotlin version of 1.1.4-3 in eclipse with kotlin-eclipse-plugin-0.8.2, which is the latest version.


#2

Why don’t you capture a CPU snapshot of your process and see exactly where the time is spent? Kotlin lambdas do not introduce any inefficiency by themselves.