Timeline for Why does a preassigned function pointer perform worse than a branch?
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 26, 2012 at 9:37 | comment | added | tokage | @Palace Chan example at ideone, of course you can use this only if you can template the Cat class | |
Jul 25, 2012 at 22:09 | comment | added | Palace Chan | @tokage wait that is interesting, where can I read about this or how does this work? | |
Jul 25, 2012 at 22:04 | vote | accept | Palace Chan | ||
Jul 25, 2012 at 15:31 | answer | added | Mysticial | timeline score: 4 | |
Jul 25, 2012 at 15:12 | history | edited | Mysticial | CC BY-SA 3.0 |
added 30 characters in body; edited title; deleted 48 characters in body; edited tags
|
Jul 25, 2012 at 15:07 | comment | added | Mysticial | What processor is this? Also, can you provide a complete SSCCE so I can run this myself? | |
Jul 25, 2012 at 14:56 | comment | added | tokage | You can avoid full specialization when you use a templated struct to wrap the specific function. Then you only need to specialize the struct and the cat class needs to be specified only once. | |
Jul 25, 2012 at 14:49 | comment | added | Sander De Dycker |
depending on funcA and funcB s complexities, they could have been inlined. I agree with @sixlettervariables that checking the assembly is a good idea. It's easy to do, and if nothing else, at least you'll rule out some possible explanations.
|
|
Jul 25, 2012 at 14:38 | comment | added | Martin Beckett | @sixlettervariables - possible more that the CPU has branch prediction while a function pointer call involves clearing stack/register. You wouldn't necessarily see this from the assem | |
Jul 25, 2012 at 14:28 | history | asked | Palace Chan | CC BY-SA 3.0 |