Is it only me or does IntelliJ become noticeably s...
# intellij
s
Is it only me or does IntelliJ become noticeably slower when .kt files are longer than the average? I think I started noticing it in files with around 700+ lines. Anyone else?
2
c
I don't have numbers to back it up, but I feel that intellij is noticeably slower on KT files or even in java files when KT is present in the project. So it does make sense to me that longer KT files would be slower still. That said, unless those files are generated code (e.g. SOAP client) I would think that design can be improved and files split. And if it was indeed generated code, I would split it into its own lib and add as a dependency to the main project.
☝🏽 1
s
Yeah I don't know. 700 lines should still be reasonable. For Test Classes at least
e
yes, I choose as limit 1k for me
c
Yeah, there is no universal number, that's why I was careful to put "I think" and "for me" all over my message 😄 Personally, I tend to get nervous after 300 lines 🙂
👍🏻 1
my largest classes are usually DTOs based on denormalized tables.
m
I guess the type inference causes most slowdowns and Java doesn't have that. It's especially bad in larger files when there is one error which causes a chain-reaction of type inferences to fail. As soon as the error is fixed everything is way faster again.
m
Agreed. The slowdown is brutal when you introduce a compile error in a large file. I’ve learned to accept it given all the pluses of working with Kotlin on a daily basis.
💯 1
1
p
What are you talking about 300, 700 lines? A compiler error in a 40 line Kotlin file completely locks up my IntelliJ for at least 10 seconds. It's ABSURD. Especially since Kotlin was specifically designed to make tooling easy. But maybe not fast? I don't understand but I am hoping it's just a matter of time since Java had a huge head start in IntelliJ.
m
That's a bug then. Even several thousand lines having errors cause only sub-second freezes for me. Report it on YouTrack
e
@poohbar you may want to do a CPU profile
p
Trust me, I don't want to.
e
I can imagine, but maybe next lock up you will change idea
m
There's no need for that. IDEA automatically generates stack trace logs when it hangs which should be sufficient here.
m
@poohbar Are you running latest version of IntelliJ and Kotlin plugin? Because I do notice it’s way better now than it was a few months or years ago. Definitely improvements across the board. But I suspect the minimum hardware for acceptable performance will be higher for Kotlin than it was for Java.
p
yeah I stay on latest...
I just think our project is bigger than usual and it has more Java than Kotlin.. it is also in Maven which JetBrains notoriously under-supports so maybe thats why.
a
Yep I have noticed them too, like 300 loc for Spek files and like 700 loc for normal kotlin files. I've started using 2019 EAP and the lag got much better now.
s
Try writing Scala for a living. Then you'll know the meaning of slow 😂
e
you do Scala, @sam?
s
Yeah, been full time Scala since 2011
I do Kotlin at home (KotlinTest and other things)
My next role will be Kotlin though 🙂
e
ah, so love @home I see 😄
what's your feedback on scala vs kotlin given your experience?
s
I think Scala is a better language (at the moment). I know I'll get shot down for saying that. But... I wouldn't use Scala if I was a business manager - because it's too hard to find employees. Kotlin is a good sweet spot between complexity and ability to cross train a regular Java dev.
Kotlin is really really missing pattern matching. I literally couldn't rewrite my current project at work in Kotlin (which we have discussed) because of the lack of pattern matching. (SQL parser and execution engine).
It also needs first class support for typeclasses in the language - not using implicits like Scala of course, perhaps something like the implied/given that's the current proposal for Scala 3
If Kotlin can gain those two features, I probably wouldn't use Scala again.
e
interesting
s
Of course take it all with a pinch of salt - that's just my humble opinion. And I'm not on the pure FP side of Scala either, I'm in the middle. The pure FPer's probably have another opinion.
e
yeah yeah, I was interested in your personal opinion
s
And bringing it back to the original post, one of the reasons I love Kotlin is that the compiler is so damn fast.
e
funny you are doing kotlintest as hobby, I'd have swear there was a business reason behind 😄
s
I started it because I wanted a clone of ScalaTest for some home Kotlin stuff as I really like ScalaTest. That was 3 years ago, but since then it's grown organically as people have requested features that I would never have thought of.
m
Typeclasses are a current request for Kotlin, and I suspect there’s work on pattern matching, especially since Java is starting to introduce it. And I would totally agree with your assessment of Scala. Scala is the ‘better’ language, or more complete BUT Kotlin is much easier to teach, has fewer sharp edges, and much better Java Interop. I’ve introduced it to a number of people that didn’t know Java (came from Host/COBOL development). They then were doing some Java, and couldn’t switch back to Kotlin fast enough 😉
👍🏻 1