Domanda

I was wondering while fixing the CheckStyle infos if that leads to any performance improvement. I understand that info cannot be taken seriously but still any comment will be appreciated.

I personally do not think they offer any such improvement but I can be wrong hence better to seek expert advice :)

È stato utile?

Soluzione

Assuming you refer to the standard Checkstyle checks: http://checkstyle.sourceforge.net/availablechecks.html They refer to the style of the source code, not really to the "style of programming". For example, code formatting ("ArrayTrailingComma", "GenericWhitespace"...) will NOT affect the actual bytecode that is generated from that class. There may be a class that causes hundreds of warnings, and anothe class that is free of warnings, and in the end, they may compile to identical bytecode.

SOME of the checks may however influence the code in a way that changes the bytecode, and thus, influences performance at least theoretically. For example, the "EqualsHashCode" check: If this causes you to insert an equals/hashCode method, this may of course affect the performance (but more importantly: The behavior of you program!). Something like "BooleanExpressionComplexity" might cause you to split up a complex expression, causing some more instructions to be generated in the bytecode. But in general, these changes should not have a really noticable effect on performance.

Altri suggerimenti

There's actually one check which can boost you performance by a large factor. If you're crazy enough to write very long methods, the JIT simply gives up and you end up with a non-optimized code. I've seen a speedup factor of 8 after fixing MethodLength (it wasn't checkstyle, it was me who said that the method was too long).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top