```#[derive(Debug, PartialEq, Eq, Deserialize, Ser...
# daft-dev
a
Copy code
#[derive(Debug, PartialEq, Eq, Deserialize, Serialize)]
pub struct Shared {
    metadata: Metadata,
    name: str,
}

#[derive(Clone, Display, Debug, Eq, Deserialize, Serialize)]
#[display("{name}#{dtype}")]
pub struct Field {
    pub dtype: DataType,
    pub shared: Arc<Shared>,
}
🙈
s
where is this code?
a
nah just saying this would be efficient (maybe) lol
I am not working on it
tho
s
For context, the metadata is rarely populated!
a
🚴
yea since it is rarely populated it makes sense to have this
only one atomic to increment
instead of two each clone
if you have an
Arc
on Metadata and str
s
Wouldn't you need a some kind of Arc or Box for the
str
? Otherwise the size of Shared wouldn't be able to be determined
a
@Sammy Sidhu
Shared
is
!Sized
but it is ok because it is an
Arc
last field can be unsized
note
Copy code
#[derive(Debug, PartialEq, Eq, Deserialize, Serialize)]
pub struct Shared {
    a: str
    b: str
}
is not valid because struct composed of two unsized types
but think of it like this
Copy code
ThisIsUnsized(str)
is equivalent to
str
and we can do
&ThisIsUnsized
just like we can do
&str
Arc
here with anything
!Sized
is a fat pointer (two
usize
)... kinda similar to how extra meta needs to be stored for slices or
Box<str>
s
Ah I see! that's useful
We can run the profiler and see if it's worthwhile to make the change
a
yea do you currently just profile all benches?