-
Notifications
You must be signed in to change notification settings - Fork 161
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
fix in ShortestVectors for issue #838 #839
Conversation
See gap-system#838 for details.
Note that Thomas suggested in the Support list that "For correcting the bug, it would be sufficient to call 'Unbind' instead of assigning an empty list [in the local function 'vschr' inside the function 'ShortestVectors']; however, it would be better to rewrite the function completely." |
@alex-konovalov : calling Unbind in a loop creates a lot of work for GASMAN, and it's not necessary. My patch produces an equivalent result and does not do this. |
@dimpase: How can the creation of unnecessary objects and their assignment to list entries be more efficient for the garbage collection than just unbinding that list entry? Also, your proposed change may cause the creation of an unnecessary shallow copy of the list in |
@frankluebeck : there is at most one unnecessary object (list entry in Although I agree that my one-liner might be more efficiently implemented as conditional unbinding of the last entry of the list in |
Any (supposed) performance implication can surely easily be shown to (not) exist by an appropriate test and benchmark. I wonder though what kind of "complete rewrite" is meant. |
Just to remind everyone - this is still open, and we need to review this and either approve or submit an alternative solution. |
How much effort does it take to review a 1-line patch clearing out an empty last entry of a list, produced under certain conditions I explained in some detail above? I'm turning 53 today, give me a birthday present by reviewing it :-) |
I don't understand why you aren't using Unbind, if you just want to get rid of a value. I can assure you, Unbind has no cost, beyond setting a pointer to 0. |
That example in #838 takes ages to verify. Do you have a shorter running one? This needs test-cases that don't run for minutes (or hours). In particular if anyone is going to try to "rewrite the function completely" at any point. |
There is an example suggested there that takes about 5 seconds on a modern laptop:
(and on unpatched code it finishes in no time with the error) Please tell me where is should go in the testsuite, I'll add it there. |
@ChrisJefferson : I prefer functional style code, that's why. |
See #838 for details and an example to check.
This is needed if "positive" is set in a call to
OrthogonalEmbeddings
and the last vectorc.vectors[anz]
produced by the functionShortestVectors
happens to be not non-negative. Then the lines rejecting it:leave an uncleared
[]
last entry inc.vectors
, resulting in the error mentioned in the issue at hand.