News for hackers. Stuff that matters.
Re:Rust: Dropping heavy things in another thread can make yo... by Reelin on Saturday May 30, 2020 @01:26PM (#23362838)
I think the contrived use case is just for illustrative purposes? If I'm understanding correctly, the combination of cleanup code and deallocation can sometimes consume enough time that it's worth dispatching it on another thread. That's hardly specific to Rust though.

As you note that will certainly add some overhead, although that could be minimized by not spawning a fresh thread each time. It could easily reduce latency for a thread the UI is waiting on in many cases.

Re:Rust: Dropping heavy things in another thread can make yo... by tedunangst on Saturday May 30, 2020 @01:48PM (#23363058)
It would be helpful to see an example from a real application, too.
Re:Rust: Dropping heavy things in another thread can make yo... by masklinn on Saturday May 30, 2020 @03:19PM (#23363836)
A very large Vec<String> (say a few million non-empty strings) would do I'd guess, Rust would drop the Vec which would recursively drop each String.
Re:Rust: Dropping heavy things in another thread can make yo... by burpsnard on Saturday May 30, 2020 @07:57PM (#23365948)
I start thinking about c++ 'placement new' and COBOL copy record structures.

And aquire/release objects from resource pools that manage themselves. And message queue handlers. And pass-by-reference, and object pools..