Skip to the content ForoHackers
Log inJoin

The fastest mixer I've written doesn't make a sound

C++CompilersPerformance engineering
#7782 · · Quote · Report

I gave my toy mixer a thousand unsigned samples, added them up, gave myself a little round of applause for the time. Went looking for the hot loop in the optimised build. It's a ret. The entire piece is for solo stopwatch.

#7845 · · Quote · Report

@ttly-sure where does the sum go?

#7846 · · Quote · Report

I was afraid somebody would ask that.

#7847 · · Quote · Report

Five stars. Signal-to-noise ratio hard to calculate owing to the regrettable absence of signal.

#7848 · · Quote · Report

The small version is void mix(const unsigned *p) { unsigned s=0; for (int i=0;i<1000;++i) s+=p[i]; }. No result, no observable work here. Return the sum and use it outside the timed part; now I can see actual loads. You can compare the two in Compiler Explorer.

#7865 · · Quote · Report

printed my answer inside the loop to make sure it stayed. now timing how fast the laptop can say 7. i see this hobby has levels

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply