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

Validate unsafe blocks are actually giving us a performance improvement #99

Open
wesleywiser opened this issue Dec 10, 2019 · 1 comment
Labels
T-measureme Related to the core measureme library

Comments

@wesleywiser
Copy link
Member

We have various places in measureme where we do low-level unsafe operations for efficiency. Example:

#[cfg(target_endian = "little")]
{
let raw_event_bytes: &[u8] = unsafe {
std::slice::from_raw_parts(
self as *const _ as *const u8,
std::mem::size_of::<RawEvent>(),
)
};
bytes.copy_from_slice(raw_event_bytes);
}

We should validate that these places are actually improving performance over their safe counterparts.

@wesleywiser wesleywiser added the T-measureme Related to the core measureme library label Dec 10, 2019
@workingjubilee
Copy link
Member

Not exactly the same but other experiences like BurntSushi/fst@7440fa7 suggest that moving from unsafe to safe code for byte-level conversions like these may not provide a measurable (heh) penalty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-measureme Related to the core measureme library
Projects
None yet
Development

No branches or pull requests

2 participants