On Mon, 10 Dec 2007, Julian Seward wrote: >> Did you see John`s followup that suggested a branch-free fast comparison? > > I tried it in Helgrind, and resulted in a slowdown compared to the > obvious "if x < y then -1 else if x > y then 1 else 0", from 2m19 > to 2m29 on one test. gcc generates poor code for it, which I suspect > is getting many partial-register-write stalls. This is something we > can come back to when the (inevitable) next round of performance tuning > happens.
John's second suggestion was better. Basically, we're comparing A and B, and returning a negative/zero/positive X based on their relative values. Then we compare X against zero. With some reconfiguration of the code we could, for the fast case, just compare A and B directly in the relevant places. I'll try to take a look at it once the release is done. N ------------------------------------------------------------------------- SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Valgrind-developers mailing list Valgrind-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-developers