-
Notifications
You must be signed in to change notification settings - Fork 41
Rust reuse memory #10
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
Comments
I tried this one and it gives me 9% speed up on the |
damn, thats amazing. Would you like to send a PR @pickfire @dovahcrow |
I would like to see that too. I tried to remove those |
I just tried it, I seemed to have faced issues with borrow checker as well. I just use transmute to increase their lifetime and it worked. But yeah, people is not happy seeing unsafe. |
@pickfire we can have another benchmark code just for unsafe and I don't mind unsafe code. may be we call it as |
@avinassh Without unsafe there is another set of optimization in place, it already have reduced allocations with that patch. |
Rather than creating the Vec in the inner loop, you can create it in the outer loop using with_capacity with capacity of batch size so it will not allocate in inner loop, then just reuse the Vec.
Once the execute is used, can just Vec clear to clear the items without deallocating memory. I wonder how much faster will it make.
The text was updated successfully, but these errors were encountered: