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

Use queue in ASMainSerialQueue #1738

Merged
merged 1 commit into from Dec 28, 2019

Conversation

hanton
Copy link
Contributor

@hanton hanton commented Nov 28, 2019

In the original implementation, when removing the first element of an array, we use the NSMutableArray's removeObjectAtIndex method, which means to remove a single item, every object in the array is shifted down one, it is O(n) time complexity.

The PR proposes to use queue, which is O(1) when removing the first element, it is more efficient.

For removing the first element, time complexity of `NSMutableArray` is O(n) while `queue` is O(1), which is more efficient.
@hanton hanton force-pushed the use-queue-ASMainSerialQueue branch from 34a754c to a8a8835 Compare December 5, 2019 08:24
@rahul-malik rahul-malik merged commit 6a2fdb2 into TextureGroup:master Dec 28, 2019
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.

None yet

2 participants