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

Split into smaller blocks if the order of block size is larger than max order #35

Merged
merged 1 commit into from
Sep 21, 2024

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)

@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