Skip to content

Use new nightly-only APIs for even more speed#29

Open
zesterer wants to merge 1 commit into
masterfrom
even-faster
Open

Use new nightly-only APIs for even more speed#29
zesterer wants to merge 1 commit into
masterfrom
even-faster

Conversation

@zesterer
Copy link
Copy Markdown
Owner

@zesterer zesterer commented May 25, 2025

This brings a simple benchmark down from 10.3 seconds to 9.5 seconds.

Comment thread src/lib.rs
// Clone the `Thread`, unpark the clone
thread.clone().unpark();
// Forget the previously owned instance, since wake_by_ref doesn't take ownership
core::mem::forget(thread);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The clone() above will increment the reference count, but this forget prevents it from being decremented, so this will leak the Thread internals.

The clone() above has to be removed for this function to be leak-free.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

You are correct. If I ever get round to work on this again I'll correct this.

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