mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-23 20:04:42 +00:00
Use a boxed slice for Export
struct (#5887)
## Summary The vector of names here is immutable -- we never push to it after initialization. Boxing reduces the size of the variant from 32 bytes to 24 bytes. (See: https://nnethercote.github.io/perf-book/type-sizes.html#boxed-slices.) It doesn't make a difference here, since it's not the largest variant, but it still seems like a prudent change (and I was considering adding another field to this variant, though I may no longer do so).
This commit is contained in:
parent
a227775f62
commit
a75a6de577
2 changed files with 5 additions and 3 deletions
|
@ -283,7 +283,7 @@ impl<'a> FromIterator<Binding<'a>> for Bindings<'a> {
|
|||
#[derive(Debug, Clone)]
|
||||
pub struct Export<'a> {
|
||||
/// The names of the bindings exported via `__all__`.
|
||||
pub names: Vec<&'a str>,
|
||||
pub names: Box<[&'a str]>,
|
||||
}
|
||||
|
||||
/// A binding for an `import`, keyed on the name to which the import is bound.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue