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

Specify number of entries parameter as (usize) integer #51

Merged
merged 1 commit into from
Apr 26, 2023

Conversation

peter-scholtens
Copy link
Contributor

While reviewing the code I was a confused by the name num_entries which suggest an integer while actually a fractional number is used. Changing this to usize and shadowing num_items locally makes the function call 7 machine code instructions shorter and the function body longer 5 instructions longer (from 65 to 70, as checked by the compiler explorer). So with improved code readability also 2 instructions less are needed.

While reviewing the code I was a confused by the name num_entries which suggest an integer while actually a fractional number is used. Changing this to usize makes the function call 7 machine code instructions shorter and the function body longer 5 instructions longer (from 65 to 70, as checked by the compiler explorer https://godbolt.org/ ). So with improved code readability also 2 instructions less are needed.
Copy link
Owner

@al8n al8n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much!

@al8n al8n merged commit e89d308 into al8n:main Apr 26, 2023
@peter-scholtens peter-scholtens deleted the patch-1 branch April 26, 2023 11:50
al8n pushed a commit that referenced this pull request Oct 17, 2023
While reviewing the code I was a confused by the name num_entries which suggest an integer while actually a fractional number is used. Changing this to usize makes the function call 7 machine code instructions shorter and the function body longer 5 instructions longer (from 65 to 70, as checked by the compiler explorer https://godbolt.org/ ). So with improved code readability also 2 instructions less are needed.
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