-
Notifications
You must be signed in to change notification settings - Fork 270
Use a custom container for Cache's cache #689
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
Conversation
The new Lru type, as a single-purpose "ArrayVec", - removes a level of indirection - omits a needless Vec allocation entirely - internalizes invariants we attempted to maintain in open-coded form It costs a little `unsafe` to handle Drop, which we unfortunately need as addr2line uses Arc inside Context.
Code size changes for a hello-world Rust program linked with libstd with backtrace: On platform
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hell yeah!
Code size changes for a hello-world Rust program linked with libstd with backtrace: On platform
|
318dd91
to
3afccb1
Compare
Code size changes for a hello-world Rust program linked with libstd with backtrace: On platform
|
let len = self.len; | ||
self.len = 0; | ||
// SAFETY: we can't touch these values again due to setting self.len = 0 | ||
unsafe { ptr::drop_in_place(ptr::addr_of_mut!(self.arr[0..len]) as *mut [T]) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cast
still requires sized, shame.
Code size changes for a hello-world Rust program linked with libstd with backtrace: On platform
|
... |
Yeah ok, no idea what that's about but revering back to |
This reverts commit b7fbd04.
Code size changes for a hello-world Rust program linked with libstd with backtrace: On platform
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is such a nice improvement, thanks!
The new Lru type, as a single-purpose "ArrayVec",
It costs a little
unsafe
to handle Drop, which we unfortunately need as addr2line uses Arc inside Context.