Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request inlines all of the methods from
FlxTypedGroupIterator
to ensure there are no object allocation when looping through a group.This is a common practice taken by Haxe developers, and it's quite good hygiene to reduce GC pressure notably if you are looping through a group each frames.
I tried this change with the following code:
Here are the following JS and C++ output without this change:
cpp:
(NOTE: for the C++ output I removed the
HXLINE
calls as it took a lot of place.)Here is the JS output with this change (the C++ output is a bit long, but I can send it if required):
As you can see, the iterator has been fully inlined and no longer causes it to be allocated.