3 ms·
Moving out of functions simplifies dependencies and arguments of calling a function. Ownership control simplifies architecture. All of eigen was originally ba
by BubRoss 7y ago
Moving out of functions simplifies dependencies and arguments of calling a function. Ownership control simplifies architecture.
All of eigen was originally based on template expressions, which are very complex. That technique / hack is not necessary if you move data structures. You no longer have to do elaborate work around to avoid copying temporaries.
- Const-me 7y ago> That technique / hack is not necessary if you move data structures longer have to do elaborate work around to avoid copying temporaries. AFAIK Eigen uses these scary template things to save RAM bandwidth. When you write x=a+b+c for large vectors, lazy evaluation will produce code that sequentially loads a, b, c, computes the sum in a register, stores to x. If you’ll use move semantics and temporary variables, the code will be compiled into auto tmp = a+b; x=tmp+c; This code computes the complete tmp variable, stores in RAM, then load again. For simple things like sum or component-wise multiplication of long vectors, RAM is way slower than ALUs.