Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #82507
| From | Juha Nieminen <nospam@thanks.invalid> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: binary_search accoring to its name |
| Date | 2021-11-29 05:57 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <so1q3b$1at4$1@gioia.aioe.org> (permalink) |
| References | <sntftt$o7$1@dont-email.me> <snvp3h$14tmm$1@gwaiyur.mb-net.net> |
Marcel Mueller <news.5.maazl@spamgourmet.org> wrote: > Assuming than a three way comparison is often a bit more expensive, it > might even be less efficient for some collections. And not only does it require a slower three-way comparison, it also uses two conditionals instead of the one that std::binary_search/std::lower_bound uses. Depending on the situation the additional conditional may actually make the code slightly slower (especially since it's likely that the CPU won't predict it correctly in about half the iterations, on average). Unpredictable conditionals are performance killers.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
binary_search accoring to its name Bonita Montero <Bonita.Montero@gmail.com> - 2021-11-27 15:38 +0100
Re: binary_search accoring to its name Marcel Mueller <news.5.maazl@spamgourmet.org> - 2021-11-28 12:27 +0100
Re: binary_search accoring to its name Bonita Montero <Bonita.Montero@gmail.com> - 2021-11-28 17:03 +0100
Re: binary_search accoring to its name Juha Nieminen <nospam@thanks.invalid> - 2021-11-29 05:57 +0000
Re: binary_search accoring to its name Bonita Montero <Bonita.Montero@gmail.com> - 2021-11-29 08:26 +0100
Re: binary_search accoring to its name Bonita Montero <Bonita.Montero@gmail.com> - 2021-11-29 14:02 +0100
csiph-web