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

Generalise functions for other uints #3

Merged
merged 2 commits into from
Mar 31, 2021
Merged

Conversation

DoubleHyphen
Copy link
Contributor

@DoubleHyphen DoubleHyphen commented Mar 29, 2021

OK, so this was way more difficult than I thought, and the code's become a bit uglier as a result. Nonetheless, the functions now ought to function not just for u32s as before but also for u8s, u16s and u64s.

Admittedly, I'd like it to be refactored at some point so the code can become cleaner. For now, however, this ought to suffice. In the meantime I'll try to think if there are other optimisations we can perform.

Oh, and also: Seeing as the LUTs for each function were only being used within that one function, I took the liberty of moving them inside those functions.

@becheran
Copy link
Owner

Looks great again! I will have a look soon. Very handy

@becheran
Copy link
Owner

I did checkout the code and get it running adding the num_traits dependency. Sad that something like num_traits is not part of rust std.

I now observe a further performance gain dropping from 600 ms to about 180 ms so this is now more in the performance range that you experienced. But were does this 3 times speedup come from? Looking at the code I don't really get it?

@becheran becheran merged commit 293aafb into becheran:main Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants