Minor improvement
LatvianModder opened this issue ยท 5 comments
Would it be a bit faster if this was if(array == null || array.length == 0)
? I think it would. Otherwise it creates new array list for every empty array too
How much better is using arrays instead of lists? I thought a list from Arrays.asList()
basically only costs extra 8 bytes or whatever for reference, and List<BakedQuad> getList()
would be faster
I made this selection after doing various profiling and measurements. Using arrays rather then arraylists used less memory consistently as the arraylists are never promoted to longer term memory and are collected much more consistently. By comparison using permanent array lists inflated constant memory usage consistently.
It seems a little backwards, but these are the results of the tests and experimentation I did to improve memory efficiency.
The main point of concern here is that while yes, keeping those arraylists around would save some cpu time, wrapping them on demand can make for significant ( not immediately obvious ) savings for large C&B structure with 100's if not 1000's of distinct models.
Nope, cause there should never be an empty array.