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

Iterator is Slow #4

Open
snakemasterepic opened this issue Apr 23, 2018 · 0 comments
Open

Iterator is Slow #4

snakemasterepic opened this issue Apr 23, 2018 · 0 comments

Comments

@snakemasterepic
Copy link
Owner

Iterator is not optimized

Build Number: 8

Priority: Medium

Severity: High

Summary

The iterator currently calls backboneIndex() and addWrinkle() which are slow.

Issue Producing Code

QuickList<String> q1 = new QuickList<>();
// Populate Q1
q1.cleanup();
// Make some more changes to the elements of q1
ListIterator<String> it = q1.listIterator();
while (it.hasNext()) {
    String s = it.next(); // Calls backboneIndex()
    if (s.equals("Cat")) {
        it.add("Dog"); // Calls addWrinkle()
    }
}
while (it.hasPrevious()) {
    String s = it.previous(); // Calls backboneIndex()
    if (s.equals("Delete me!") {
        it.remove(); // Calls addWrinkle()
    }
}

Observed Output

The list is not optimized and is slower than ideal.

Expected Output

The list is optimized.

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

No branches or pull requests

1 participant