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

Special casing identity in permutation operations #3547

Closed
ChrisJefferson opened this issue Jul 7, 2019 · 2 comments · Fixed by #3566
Closed

Special casing identity in permutation operations #3547

ChrisJefferson opened this issue Jul 7, 2019 · 2 comments · Fixed by #3566
Labels
kind: discussion discussions, questions, requests for comments, and so on

Comments

@ChrisJefferson
Copy link
Contributor

As an experiment, I decided to check how many of the times someone operates on permutations, one of the permutations is the identity, when running testinstall

p*q : 19% of 3410082
Quo: 6% of 690495
Conj: 5% of 30276
p^i for integer i: 2% of 53155

So, given that I think it's certainly worth special casing p*q to handle p or q being the identity. It's probably worth it for quo and conj as well, as we have calculate the length of both permutations, so all we are doing is a comparison on something we already have in a register anyway.

@ChrisJefferson ChrisJefferson added the kind: discussion discussions, questions, requests for comments, and so on label Jul 7, 2019
@wilfwilson
Copy link
Member

I think you’re probably onto a good idea.

However, I’d recommend doing some kind of quick sanity check on the data that you got.

It could be the case that there is just one crazy test in testinstall that’s accounting for almost all of those operations involving the identity. In which case, actually operations involving the identity might be very rare in normal use. Unlikely, but worth a check before putting work into it, I’d say.

@wilfwilson
Copy link
Member

@ChrisJefferson started telling me that he'd looked into this further, and then our conversation got interrupted, so I don't know what his conclusion was...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: discussion discussions, questions, requests for comments, and so on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants