Hacker News new | ask | show | jobs
by jeorgun 4384 days ago
How would this lazy-vector-mapping compare to the optimizations used in std::valarray? Or are those optimizations just the ones you mention here?
1 comments

Apologies, I did not see your question in time. Note that valarray is just a standard API, an implementer can write it as they wish. That said, these kinds of optimizations were indeed a motivation for creating valarray. Standard libraries do use exactly these optimizations in valarray (with some SIMD vectorization thrown in as well). You can also take a look at pixelglow's implementation, he has a comment downstream. It is pity that no one in the standards committee took ownership of valarray and it was included in a semi broken state.