Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #14435
| From | Mike McCarty <mcmccarty@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: min/max by value - 25% faster |
| Date | 2012-02-22 14:06 -0800 |
| Organization | http://groups.google.com |
| Message-ID | <4865161.1943.1329948384814.JavaMail.geo-discussion-forums@vbtv22> (permalink) |
| References | <d06bfb98-0fdb-4ca9-95e3-15faea0dfb4d@n12g2000yqb.googlegroups.com> <22215970.508.1329922612474.JavaMail.geo-discussion-forums@vbas10> <3ecfb865-1293-4bc8-94ad-d541a1a3b8d1@eq5g2000vbb.googlegroups.com> |
420K iterations/second? That's ~2us per iteration == very slow (as in unbelievably so). It should take on order of nanoseconds, not microseconds. In any case, it is possible that the optimizer realized that min(x,y)+max(x,y) == x+y and elided the conditional branches entirely. It may not have been able to make that elision via references. You might want to try making your benchmark less trivial.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
min/max by value - 25% faster Eirik <eirik.olimstad@gmail.com> - 2012-02-22 04:56 -0800
Re: min/max by value - 25% faster Mike McCarty <mcmccarty@gmail.com> - 2012-02-22 06:56 -0800
Re: min/max by value - 25% faster gwowen <gwowen@gmail.com> - 2012-02-22 07:56 -0800
Re: min/max by value - 25% faster Eirik <eirik.olimstad@gmail.com> - 2012-02-22 10:00 -0800
Re: min/max by value - 25% faster Mike McCarty <mcmccarty@gmail.com> - 2012-02-22 14:06 -0800
Re: min/max by value - 25% faster BGB <cr88192@hotmail.com> - 2012-02-22 16:37 -0700
Re: min/max by value - 25% faster Joshua Maurice <joshuamaurice@gmail.com> - 2012-02-22 14:16 -0800
Re: min/max by value - 25% faster Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-22 22:23 +0000
Re: min/max by value - 25% faster Eirik <eirik.olimstad@gmail.com> - 2012-02-23 04:47 -0800
Re: min/max by value - 25% faster Miles Bader <miles@gnu.org> - 2012-02-23 22:43 +0900
Re: min/max by value - 25% faster Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-02-23 15:39 +0000
csiph-web