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

Improve LinkedList Array initliasier #958

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pwallrich
Copy link

@pwallrich pwallrich commented Dec 23, 2020

Checklist

Description

Improves the Linked List initiliaser to not use append for each element.
When using append, it iterates through the whole LinkedList everytime an item is appended.

Init with 10k Items before:

Executed 1 test, with 0 failures (0 unexpected) in 8.394 (8.395) seconds

Init with 10k Items after:

Executed 1 test, with 0 failures (0 unexpected) in 0.083 (0.084) seconds

Only issue I found, is that the Test crashes with a Bad Access, when using 100k items. I stopped testing if that happens with the old implementation after 50k though, because it already took a couple of minutes to get to 50k and it gets slower, the more items are added. I used the implementation with > 1.000.000 items without problems though

I didn't change the arrayLiteral initialiser, because I don't see anyone, typing that many numbers :)

@protodimbo
Copy link

Well done

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