Skip to content

Conversation

@bigsaltyfishes
Copy link
Contributor

No description provided.

src/lib.rs Outdated

// If the order of size is larger than the max order,
// split it into smaller blocks.
if size.trailing_zeros() as usize > (ORDER - 1) {
Copy link
Member

@jiegec jiegec Sep 21, 2024

Choose a reason for hiding this comment

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

I think comparing size and 2^ORDER is easier and faster here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since trailing_zeros calculation is calculated again when adding a block to free_list, I think we can calculate it first for comparison, if the block needs to be split, just simply assign it as the maximum ORDER, I think this should be faster. (I've forced-push this change)

…ax order

Signed-off-by: bigsaltyfishes <bigsaltyfishes@gmail.com>
@jiegec jiegec merged commit a9e1a04 into rcore-os:master Sep 21, 2024
2 checks passed
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