Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Iterator allocations #47

Open
eveliotc opened this issue Oct 16, 2014 · 4 comments
Open

Iterator allocations #47

eveliotc opened this issue Oct 16, 2014 · 4 comments

Comments

@eveliotc
Copy link

Use of enhanced for loop syntax (e.g. for (SpringListener listener : mListeners) {) causes the creation of unwanted garbage every frame, in example here is a capture of Inertia Ball demo

Iterator allocations

Would you consider not using it particularly in methods which are called often like advance?

@willbailey
Copy link
Contributor

Yes absolutely we should fix this. Happy to take a pull request or I can fix it up this weekend.

@ghost
Copy link

ghost commented Aug 4, 2015

Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.

@mfurtak
Copy link

mfurtak commented May 8, 2016

Hi @willbailey - I'm interested in submitting a PR for this change!

How would you feel about substituting CopyOnWriteArrayLists with contains() checks on addition, for the CopyOnWriteArraySets? My initial experiments seem positive.

Before:

screen shot 2016-05-07 at 8 50 15 pm

After:

screen shot 2016-05-07 at 9 10 08 pm

@mfurtak
Copy link

mfurtak commented May 8, 2016

Upon further thought, all of these Iterators are what are providing the thread-safe iteration guarantees. Any solution that removes those CowIterator allocations will be removing those guarantees (without other arrangements being made).

That leaves me curious - what solution were you imagining?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants