Rust: Dropping heavy things in another thread can make your code 10000x faster
1–10 of 285 posts
Re: Rust: Dropping heavy things in another thread can make your code 10000x faster
#2Re: Rust: Dropping heavy things in another thread can make your code 10000x faster
#3Re: Rust: Dropping heavy things in another thread can make your code 10000x faster
#4I'm hoping this is down to developer naivety rather than being a feature of rust.
Re: Rust: Dropping heavy things in another thread can make your code 10000x faster
#5Re: Rust: Dropping heavy things in another thread can make your code 10000x faster
#6hmm my first thought its, having to do that is a lot like c and cleaning up my own allocations. This feels like something rust should automatically do for me?
Re: Rust: Dropping heavy things in another thread can make your code 10000x faster
#7Why would you ever write a get_size function that drops the object you call it on? Surely in an actual, non-contrived usecase spawning another thread and letting the drop occur there would just be plain worse?
Re: Rust: Dropping heavy things in another thread can make your code 10000x faster
#8hmm my first thought its, having to do that is a lot like c and cleaning up my own allocations. This feels like something rust should automatically do for me?
In C, if you forget to clean up, you have a memory leak which is hard to track down. In Rust, if you don't do this, you're not sacrificing memory leaks, only performance. A profiler can tell you when you should drop asynchronously.
Is there any profiler that does this today?
What are the drawbacks with asynchronous drops?
Re: Rust: Dropping heavy things in another thread can make your code 10000x faster
#9Re: Rust: Dropping heavy things in another thread can make your code 10000x faster
#10I'm not very familiar with Rust, but I don't understand why you wouldn't just use a reference-to-HeavyThing as the function argument, so that the object isn't moved and then dropped in the `get_size` function?