Skip to content

Garbage collection and list iteration improvements for v3.1#517

Merged
pspeed42 merged 3 commits into
jMonkeyEngine:v3.1from
tiatin:v3.1
Jun 27, 2016
Merged

Garbage collection and list iteration improvements for v3.1#517
pspeed42 merged 3 commits into
jMonkeyEngine:v3.1from
tiatin:v3.1

Conversation

@tiatin
Copy link
Copy Markdown
Contributor

@tiatin tiatin commented Jun 26, 2016

Same as #515, but for v3.1.

tiatin added 3 commits June 26, 2016 15:08
For-Each loop creates Iterator object and uses hasNext and next methods, which are slower, than manual iteration. Also allocating Iterator object increases work for GC.

Forum post: https://hub.jmonkeyengine.org/t/iteration-over-list-performance-improvement/36250

See test 9 for more details: http://www.devahead.com/blog/2011/12/coding-for-performance-and-avoiding-garbage-collection-in-android/
Reason for this is that if List is LinkedList, complexity for get(int i) is O(n/4).
…n performance reasons. Fixed bug in SafeArrayList.equals().
@tiatin tiatin changed the title Iterator garbage collection improvement Garbage collection and list iteration improvements for v3.1 Jun 26, 2016
@pspeed42 pspeed42 merged commit 02c5d9d into jMonkeyEngine:v3.1 Jun 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants