Use a custom container for Cache's cache#689
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
|
|
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.
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
|
ChrisDenton
left a comment
There was a problem hiding this comment.
This is such a nice improvement, thanks!
The new Lru type, as a single-purpose "ArrayVec",
It costs a little
unsafeto handle Drop, which we unfortunately need as addr2line uses Arc inside Context.