-
-
Notifications
You must be signed in to change notification settings - Fork 538
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
Improve Vec2
#9830
Comments
Personally, I would say the best next step would be to update all the methods so they follow The only thing I'm aware of which will be really tricky porting from To get some of those optimizations, we'd need separate methods e.g. The only thing I think that's missing from your list is removing the |
It would also be good to remove We could wrap By the way, the reason why I think we should have separate struct Allocator {
/// Stores the AST (same as now)
ast: Arena,
/// Stores `Semantic`
semantic: Arena,
/// "Scratch" space for temporary data in transformer etc, to avoid heap allocations
temp: Arena,
} But we can make How about we split the work - I'll work on the |
A couple more vague thoughts:
|
I was thinking of changing the
|
That's a good idea, I am okay to work on |
Thanks for your suggestions, I've updated the checklist and adjusted the order. |
The following tasks are for
Vec
, I intend to work on them in order.push
by adding agrow_one
method, like https://doc.rust-lang.org/src/alloc/raw_vec.rs.html#338-343 feat(allocator/vec2): add specializedgrow_one
method #9855 perf(allocator/vec2): replaceself.reserve(1)
calls withself.grow_one()
for better efficiency #9856std
#9857handle_alloc_error
function fromallocator_api2
instead of writing a custom one #9860used_cap
andneeded_extra_cap
params names tolen
and additional` to make it like the same as the standard implementation does refactor(allocator/vec2): rename parameters and method name to align withstd
#9858retain
method with the standard implementation #9752len
andcap
tou32
Vec2
intoVec
#[expect(...)]
attr (not decide when to start, but it probably starts when all methods implementation has aligned withstd
)&Arena
instead of&bump
ImproveVec2
#9830 (comment)The text was updated successfully, but these errors were encountered: