3 ms·
Here’s a short example to show how this gets hard. Add the ability to do point-wise arithmetic on C++ vectors By implementing operator+ and such. Let’s comp
by BobbyTables2 2y ago
Here’s a short example to show how this gets hard.
Add the ability to do point-wise arithmetic on C++ vectors By implementing operator+ and such.
Let’s compute A = (B + C) * D
The addition result is stored in a temporary vector and then processed again for the pointwise multiplication.
It would have been far better to avoid the temporary object (and associated memory allocation + cache pressure) and compute everything at once before moving the next index.
That becomes ridiculously non trivial to do ergonomically in C++ without extensive template meta programming —- with little thanks to the compiler.
I suspect One might even be able to argue with that C/C++ semantics in terms of sequence points and such very well might even forbid a mythical compiler to optimize and reorder function calls across loops and such.
Of course, the juicy arithmetic goes far beyond pointwise operations too…
Yeah, HPC is still the domain of humans for the time being.