Skip to content
Advertisement

Does line length affect performance? [closed]

I have very long lines using lambda. Also, for example, I combined two loops with a condition into one line. Will such actions affect performance? Not for readability! Only I work with the code, and it reads great for me.

Example 1 (I have longer lines):

JavaScript

Example 2:

JavaScript

Advertisement

Answer

Java is a compiled language, and line length is irrelevant to the compiler. However, it will affect the readability of your code. Longer lines are – generally – less readable, which makes it harder to understand your code, and therefor harder to maintain it.

In other words, don’t write code like this.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement