flint icon indicating copy to clipboard operation
flint copied to clipboard

Try to optimize a couple of things

Open albinahlback opened this issue 1 year ago • 4 comments

This PR seems to be faster when ADX is available, but I had troubles getting consistent results. I don't know if these changes for fmpz_mul and fmpz_sqr are actually faster.

Perhaps there are things one could optimize, and if so, I would be happy to do so.

Perhaps X_mat_neg could have a X_mat_inplace_neg instead.

NOTE: I think the assertion worker will fail due to fmpz_mul and fmpz_sqr allowing aliasing under certain circumstances when ADX assembly is enabled.

albinahlback avatar Jan 23 '24 12:01 albinahlback

Hmm, I think I have to split this into smaller PRs.

albinahlback avatar Jan 23 '24 13:01 albinahlback

Hmm, I think I have to split this into smaller PRs.

Yes.

The inplace functions look nice though. Is foo_neg_inplace a better name than foo_inplace_neg?

fredrik-johansson avatar Jan 25 '24 11:01 fredrik-johansson

The inplace functions look nice though. Is foo_neg_inplace a better name than foo_inplace_neg?

foo_method_inplace is nice because you can search for foo_method, and this will pop up. However, foo_inplace_method is somewhat more futureproof in case foo_inplace becomes it's own module. It is also nice to search for foo_inplace, and you see what inplace methods are available. I don't have a strong opinion here, I'll let you decide.

albinahlback avatar Jan 25 '24 11:01 albinahlback

foo_method_inplace is nice because you can search for foo_method, and this will pop up.

That is my thinking.

However, foo_inplace_method is somewhat more futureproof in case foo_inplace becomes it's own module.

It sounds extremely specialized to have whole modules just for inplace versions of functions.

It is also nice to search for foo_inplace, and you see what inplace methods are available.

I think you are more likely to search for versions of a specific operation than for a group of inplace operations.

fredrik-johansson avatar Jan 25 '24 12:01 fredrik-johansson