4 ms·
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
by Reelin 6y ago
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.
- tedunangst 6y agoIt would be helpful to see an example from a real application, too.
- masklinn 6y agoA 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.
- burpsnard 6y agoI 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..