-
Notifications
You must be signed in to change notification settings - Fork 59
Drop Ustr Dependency #533
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
Drop Ustr Dependency #533
Conversation
Co-authored-by: Micah <[email protected]>
|
I haven't commented on this because I was curious what the results would be. I felt it unlikely that it would improve things much, but I as curious. Given that the results are unimpressive or just downright bad, I am going to put a pin in this and say thank you for the exploration but we aren't interested in doing this. We just adopted Ustr, and it's a much better solution than attaching lifetimes to everything just from a DX standpoint. The memory footgun you ran into with the string internment is something we can work to make more obvious or safer (I would be open to a method for |
Is this referring to the serialization performance dropping or the developer experience when managing lifetimes? I assume the latter. I figured as much and was prepared for this to be rejected, but I thought it was worth a shot with how far it's come. Thanks for taking a look. |
Both! If it doesn't make a difference for deserializing, make serialization performance worse, and makes the DX worse I think it's obvious that we can't do it. |
|
I expect that the performance issue can be addressed, but exposing lifetimes seemed like a dealbreaker which is why I didn't look into the performance issue. I was never doing this for speed, it was for memory control. The next best thing to dropping ustr is replacing rbx_dom_weak with rbx_dom_strong, and I've already put in some work there #92 to generate the types. I can't seem to get rbx-dom out of my head, so see you around! |
|
The performance issue affects the serializer in general, and is addressed in #544 and added to the dependencies of this PR. I wanted to prove that the performance issue was not caused by these changes, it was merely magnifying an existing bottleneck in the serializer. Here is the performance uplift for this PR from rebasing onto #544: After rebasing on top of #544, this PR is +17% faster than the master branch in both serialization and deserialization. However, it is -18% behind #544 in serialization without this on top, so there may be another serializer improvement waiting to be found. I tested against both master branch and the prereq branch, this PR got +17% vs master and +15% vs prereqs for "Miner's Haven/Deserialize". Not sure why there was no deserialization uplift was when I was testing before, but we take those. Now dropping ustr is a pure performance win and memory control benefit compared to master branch, so if the performance was the dealbreaker then that is no longer an issue. |
|
I've been considering whether to put more effort into this, but I think my effort is better spent on #92. Closing in favour of working on that. |

Closes #515.
Here's a draft of what it could look like to drop the ustr sledgehammer in favour of fine-grained memory control. This addresses all my concerns in #515, and is the culmination of my exploration efforts there. There is only enough code here to run
rbx_binarybenches, but the rest of the code for rbx_xml, rbx_util, rbx_reflector, etc. can be adapted from my raw-str branch krakow10/rbx-dom@1482a07...raw-str, which is where most of this code came from as well.Here are just the commits for this PR on top of the five prerequisite PR dependencies:
branch krakow10/rbx-dom@prereq...lifetimes
Overview:
Ustrcompletely in favour of&'a strfor properties and class namesWeakDomandInstancefor propertiesDecodeOptionsto rbx_binary with an optional string internerPerformance:
Deserialization is within 2%, but Serialization performance seems to be significantly (40%) slower, which I don't understand why.Performance vs master branch is now at +17% for both serialization and deserialization.There are three supported use cases:
WeakDom<'static>:DecompressedFilebinding, required to outliveWeakDom<'dom>: