Does type inference perform slow autocomplete in the IDE

When using Scala for the first time in the IDE (Idea), I noticed that autocompletion is noticeably slower, and then when coding java. Although some of the slowdowns may be related to the relative immaturity of the Scala tool ecosystem at the time, I suspect that some of this slowdown may be an integral property of the algorithmic complexity of code analysis requiring type inference.

java:

MyType type; type.doSomething() //Class of type already known 

scala:

 val type = new MyType; type.doSomething() //Class of type must be inferred or cached 

Although languages ​​that have type output are much more concise (and therefore easier to read), does this come at the expense of slower tooling? Is there an inherent compromise?

+5
source share
1 answer

Yes.

To some extent, Scala is inevitably slower. One of the costs of supposed types, implications, and syntactic sugar is compilation time. Exact times can be improved, but Scala will always compile more slowly than for ex.java.

Personally, I am happy to make this compromise. Having a clean and readable code base is much more important to me than compilation time (which is often less than 1 second if incremental compilation is used).

+1
source

Source: https://habr.com/ru/post/1242207/


All Articles