-
-
Notifications
You must be signed in to change notification settings - Fork 477
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
perf(parser): try Blink
allocator for the AST
#88
Comments
@zakarumych I've gone through the docs ( So given I have nightly on, how do I go about replacing bumpalo? And will this remove all the lifetimes from the AST (which would be awesome)? |
allocator-api2 mimics traits and types from core and alloc to enable usage on stable. No. You won't get rid of lifetimes easily since BlinkAlloc should shared between containers rather than cloned. Implement unsafe reset_unchecked method that takes &self. Place BlinkAlloc into static and voila, &'static BlinkAlloc gives 'static allocations. |
@zakarumych Would it be too much of an ask for you to add some building blocks for me? I'm super confused :-/ |
What seems to be missing? |
Prefacing the below with: I'm new to Rust, and I'm also not deeply familiar with this project's usage of arena allocations. (@Boshen please correct any mistakes) To get this to work within Rust's lifetime constraints, the allocator(bumpalo) is created and passed to the parser's constructor. It seems there's a general incompatibility between the utilities and function signatures bumpalo provides vs blink. pub fn alloc<T>(&self, val: T) -> &mut T blink's put() is pub fn put<T: 'static>(&self, value: T) -> &mut T (I'm entirely confused by the static lifetime) bumpalo's Vec is pub struct Vec<'bump, T: 'bump> blink's is: pub struct Vec<T, A: Allocator = Global> Trying to replace bumpalo usage with blink comes up at a dead-end, where it seems to me the API's exposed by blink aren't sufficient (and it's as if I should go implement it - except I have no idea if/how it fits in with Blink, from a "provider"'s perspective). |
@YoniFeng Your understanding of how @zakarumych Can you help us a little more on how to make I presume we start replacing this with And we want to end up with the replacement of these APIs with the Please excuse us for our unfamiliarity around this topic. |
Blink
allocator for the AST
Oops, I didn't see the PR #106 first, I'm going to look at it now. |
As you've seen in a PR a type-alias helps to match |
Closing due to inactivity. Please reach out if you want to work on this again. And thank you for working on this, I learned a bunch from your work. |
https://twitter.com/zakarum4/status/1630669810110545921
https://github.com/zakarumych/blink-alloc
cc @zakarumych
The text was updated successfully, but these errors were encountered: