Live data from Hacker News

The Hunt for the Fastest Zero

travisdowns.github.io

1–8 of 8 posts

Re: The Hunt for the Fastest Zero

#8
post #6

I'd use std::memset and have something that works without needing a benchmark to detect obscure template quirks.

I agree. Why go through the extra loops? Keep it simple.

std::memset only works for sequential and contiguous memory. std::fill works on pretty much anything that has std::begin() and std::end().

As the conclusion of the article says I would use the idiomatic way first, then and only if I have performance issues, actually force it to memset.

The only bad thing here is that, gcc only do the reasonable optimization on '-O3'.