Replies: 1 comment 1 reply
-
I'm glad to help. I took a quick look and, for the moment, I have just one suggestion. There's an alternative for
Notice that we check divisibility by
Now, since Notice the missing Final remark which, although not related to your code, I hope you enjoy 🙂: The now obsolete .NET6 implementation, took profit of the math above. However, their code followed the traditional logic that first checks divisibility by 4 and contains branches. So although they saved one instruction the performance got worse. The reason is hinted in my talk: branching on I will need more iterations at your code to see if I can spot any other improvement but overall, I think it is very efficient. Good stuff! |
Beta Was this translation helpful? Give feedback.
-
The current library compiled to assembly can be viewed conveniently here on godbolt: https://godbolt.org/z/hjfvj9a1v
Documentation and other noise has been stripped for easy comparison between source and assembly.
@cassioneri I would be delighted if you could take a quick peek through the generated assembly for the entire library to see if anything terribly obvious strikes out as being inefficient. But I understand if you are too busy. I am planning on releasing 0.1.0 of the library now that I think the public api asserting and datatypes are the way they should be.
Beta Was this translation helpful? Give feedback.
All reactions