Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

large FlxGroup changes #2806

Merged
merged 10 commits into from
Jun 21, 2023
Merged

large FlxGroup changes #2806

merged 10 commits into from
Jun 21, 2023

Conversation

Geokureli
Copy link
Member

@Geokureli Geokureli commented May 18, 2023

  • Changed a lot of while loops to for loops, this was a relic from the flash days, js haxe will turn them back into for loops but this is more readable
  • Move function scoped vars to for loop scoped vars when they are only used in the loop, same reason as above
  • Add killMembers and reviveMembers and keyValueIterator
  • Add new searching utils getFirst, getLast, getFirstIndex, getLastIndex, any and every
  • Use inlined getFirst for all other, similar search utils
  • Replace getFirstNull's loop with a simple indexOf check
  • add unit tests for new and changed FlxGroup features

@Geokureli Geokureli added this to the 5.4.0 milestone Jun 1, 2023
@NeeEoo
Copy link
Contributor

NeeEoo commented Jun 5, 2023

I always thought the old group loop method were to reduce memory allocation or cpu cycles

@Geokureli
Copy link
Member Author

I'm pretty sure its a remnant from the flash days, declaring loop vars outside of the loop was very common in flash. either way, if there were benefits, they're likely insignificant and not worth the lack of readibility, but I'll see if i can back up that claim

@NeeEoo
Copy link
Contributor

NeeEoo commented Jun 5, 2023

I could be wrong, but iirc i also saw the old method being done in javascript projects.

@Geokureli
Copy link
Member Author

for loops are converted to while loops for javascript, anyway. https://try.haxe.org/#8F85C046
Ignore the haxe_iterators_ArrayIterator, thats an DCE issue and you can see that a while loop is used

@Geokureli Geokureli changed the title simplify FlxGroup loops and rename args large FlxGroup changes Jun 21, 2023
@Geokureli Geokureli merged commit 71081e8 into HaxeFlixel:dev Jun 21, 2023
Geokureli added a commit that referenced this pull request Jul 3, 2023
@Geokureli Geokureli deleted the group-cleanup branch August 9, 2023 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants