-
Notifications
You must be signed in to change notification settings - Fork 108
[RFC007] Move position-related stuff to the position module, add mutable content ref #2303
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
|
| Branch | rfc007/value-lens |
| Testbed | ubuntu-latest |
Click to view all benchmark results
| Benchmark | Latency | microseconds (µs) |
|---|---|---|
| fibonacci 10 | 📈 view plot 🚷 view threshold | 299.22 µs |
| foldl arrays 50 | 📈 view plot 🚷 view threshold | 403.05 µs |
| foldl arrays 500 | 📈 view plot 🚷 view threshold | 3,775.10 µs |
| foldr strings 50 | 📈 view plot 🚷 view threshold | 4,658.60 µs |
| foldr strings 500 | 📈 view plot 🚷 view threshold | 46,301.00 µs |
| generate normal 250 | 📈 view plot 🚷 view threshold | 41,548.00 µs |
| generate normal 50 | 📈 view plot 🚷 view threshold | 1,632.00 µs |
| generate normal unchecked 1000 | 📈 view plot 🚷 view threshold | 2,183.50 µs |
| generate normal unchecked 200 | 📈 view plot 🚷 view threshold | 454.02 µs |
| pidigits 100 | 📈 view plot 🚷 view threshold | 2,371.50 µs |
| pipe normal 20 | 📈 view plot 🚷 view threshold | 698.98 µs |
| pipe normal 200 | 📈 view plot 🚷 view threshold | 6,065.90 µs |
| product 30 | 📈 view plot 🚷 view threshold | 253.25 µs |
| scalar 10 | 📈 view plot 🚷 view threshold | 588.26 µs |
| sum 30 | 📈 view plot 🚷 view threshold | 256.54 µs |
43e92b1 to
8051133
Compare
8051133 to
47ef78e
Compare
| // over `self`, so there can't be other active mutable borrows to the block | ||
| Some(match header.tag { | ||
| BodyTag::Number => ValueContentRefMut::Number( | ||
| ValueBlockRc::decode_mut_from_raw_unchecked(as_ptr), |
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.
Does it work to let rc = ValueBlockRc::decode_mut_from_raw_unchecked(as_ptr), so you don't have to repeat the part? Or is there some subtlety that I'm missing?
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.
decode_xxx takes a type parameter indicating to which type this function should decode. Here it's hidden because the type checker has enough information to deduce what is this target type T (given the definition of ValueContentRefMut::XXX), but each of this calls return a totally different type, so we can't really factor them out.
core/src/bytecode/value/mod.rs
Outdated
| /// increments the reference count but encapsulate a pointer to the same block in memory (as | ||
| /// [std::rc::Rc::clone], this method actually allocates a fresh block with a copy of the | ||
| /// content and return a value that is 1-reference counted. | ||
| pub fn deep_copy(&self) -> Self { |
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.
I usually think "deep copy" means that it also descends recursively and deep copies all references (e.g. https://docs.python.org/3/library/copy.html).
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.
That's fair, I'll try to come up with a better name.
Yet another slice of work on the compact value representation, split off from #2302. This PR:
valuetoo muchIn general, additions to the
valuemodule are driven by the needs encountered when working on #2302.