jmonkeyengine icon indicating copy to clipboard operation
jmonkeyengine copied to clipboard

Performance improvements

Open tonihele opened this issue 1 year ago • 9 comments

Performance improvements. From static code analysis. All Java 8 compatible (is this the official code level?).

There are few types of improvements:

  • Switching manual array copying to a system call (is this ok on Android??)
  • String concatenation / string format to use StringBuilder properly
  • Creating/copying collections switched to use bulk operation
  • Some early breaks to loops
  • Use Files to get Input/OutputStreams. At least on Windows this is proven to give faster stream implementation
  • Collection.toArray size thing (https://shipilev.net/blog/2016/arrays-wisdom-ancients/)

This should be all pretty safe stuff. I did not benchmark this separately at all. These are based on static code analysis.

tonihele avatar Mar 13 '24 15:03 tonihele

Note that if merged, use SQUASH and merge. I accidentally added some test files in the process. The Squashing will rewrite this so that that oopsie never happened... right? Anyway, nothing dirty, Jaime heads in various formats

tonihele avatar Mar 13 '24 15:03 tonihele

re: your description when it says "Arrays.asList size thing" I think you mean "Collection.toArray() size thing"

Curious: what static code analysis was used?

pspeed42 avatar Mar 13 '24 16:03 pspeed42

Curious: what static code analysis was used?

I used IntelliJ's.

re: your description when it says "Arrays.asList size thing" I think you mean "Collection.toArray() size thing"

Correct. Fixed to description.

tonihele avatar Mar 13 '24 16:03 tonihele

Is this now ok to merge? I believe I did all the requested changes?

tonihele avatar May 14 '24 08:05 tonihele

I haven't finished looking at all 107 files.

stephengold avatar May 17 '24 02:05 stephengold