-
Notifications
You must be signed in to change notification settings - Fork 79
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
Update for Groovy #27
Conversation
sorry, to nag here, but to be able to see what has been changed the patch must be reduced to only logical changes. Please do not apply whitespace changes, and none of the Intellij Idea code "improvements", like changing an if to the ternary operator, don't rename variables and don't reorganize imports. Such things should be seperate commits. Then it is more easy to see things like
deleteing these lines is not right, but it could be a github diff view glitch. |
OK, removed the cleanup part. |
The computational complexities are these.
O(n^2) must be avoided. Also, I updated the patch, and changed these.
|
I agree that list-to-head performance is not good, but I was not talking about computational complexity. I was talking about memory complexity and there the old iterator had a memory requirement of O(1), while the new one has a memory complexity of O(n) |
ConsPStack is already using O(n) space complexity. |
I did not mean ConsPStack, I did mean the iterator. And while O(2n) is still O(n), it makes still a big difference for finite memory |
Of course I understand it is about ListIterator.
I believe you do not misunderstand, |
yeah, we are both speaking about ListIterator;) 4 or 8 bytes is not much, but as you said, it is per element. This means of your ConsPStack consumes half of the available memory, it is possible, that creating the ListIterator will cause an OutOfMemoryException, while using the normal Iterator will work. But maybe it is ok enough to add a big warning to the javadoc of that method about it not being "in situ" / in-place |
It is not half! If the element is using 64 bytes, |
you are right |
Sadly I think this and groovy/groovy-core#482 are stale now, so even though it looks like there's some cool stuff in here I'm going to close this as it's too big for me to sift through to find the gems. But if there are any parts of this that could be rescued as their own smaller PRs that would be welcome! |
A patch for Groovy.
Read groovy/groovy-core#482 for the detail.