string embedding#2237
Conversation
bda3944 to
431a74d
Compare
| type InnerIntRepr = u64; | ||
|
|
||
| #[derive(Debug)] | ||
| struct StrInner(ManuallyDrop<Box<str>>); |
There was a problem hiding this comment.
Could put this in rustpython_common::str, maybe
431a74d to
c1356fd
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
c1356fd to
0fc429f
Compare
|
that sounds like more to string interning for constant string, right? I thought vm can hold a vec of PyStringRef for that. In this PR, I am trying short string embedding here. It will reuse fat pointer memory allocated for Box. |
|
Ah, okay, that makes sense, I guess I misinterpreted what you meant by embedding |
0fc429f to
afb93d5
Compare
fda5f2a to
6aac8c7
Compare
6aac8c7 to
07a3b66
Compare
|
Looking at the source for embed-str -- is there a reason you did |
|
Also, when you |
|
@Kroisse introduced https://docs.rs/string_cache/ for string interning |
I think that's compact expression for About mode, i'd better to use exact byte from byte array. But does it actually need to be stored as MaybeUninit? we can access only to initailized bytes and it doesn't have any drop behavior. |
|
I think this PR requires benchmark before merging |
Oh, lol, I completely missed the
Yeah, unfortunately, it's still UB even if you're not accessing them, since you can't trust that the compiler won't optimize it to access some of the uninitialized memory -- there's a good article I read about it but I can't find it right now. |
|
It seems that the |
No description provided.