-
Notifications
You must be signed in to change notification settings - Fork 42
Try reusing memory #15
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
base: master
Are you sure you want to change the base?
Conversation
|
Is it possible to avoid unsafe in this? |
I can't think of anything to help avoid these |
|
One thing I tried to do was using for batch in values.iter() {
let (a,b,c) = batch;
row_values.push(named_params!{":area": a, ":age": b, ":active": c});
}but |
|
I switched to use https://docs.rs/rsor/0.1.2/rsor/ rsor library as suggested by @upsuper (he suggested a related library with runtime checks). std does not provide these tools and it only have compile-time cost. |
|
I ran it and I did not see much difference: |
|
What's the difference? 1s? |
|
@pickfire yup, seems so. |
|
Yeah, but it's consistent 1s and reduced memory allocation, I am not sure how good the effect will be on other parts. |
Fix #10
Unsafe is probably not nice but I am not sure how to satisfy borrow checker there. I tried using
mem::swapand related functions but it still seemed like the borrow checker does not know that the reference is not longer valid whenvec.clear().29s -> 27s