3 ms·
There are lots. For a single-threaded program, moving around unique_ptrs or, equivalently, value objects, suffices. For parallel execution, maybe you add thread
by ncmncm 6y ago
There are lots. For a single-threaded program, moving around unique_ptrs or, equivalently, value objects, suffices. For parallel execution, maybe you add threads and mutexes, or futures, and possibly shared_ptr or a moral equivalent.
The point is that you have a lot of choices to make that are only peripherally related to the problem the code is supposed to be solving. Those choices might allow you to tune the performance of operations better to the problem, but they may be just a distraction from the goal.
For most systems, nobody knows how fast it should be able to go, or whether you got close. Almost as often nobody even cares very much, or cares at all. When they don't, it is wasted effort to spend a lot of time and skull-sweat optimizing performance. There, a straitjacket language that offers few choices is best. It lets you get on to the next thing.