Timeline for Help with optimizing virtual method
Current License: CC BY-SA 4.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 27 at 8:37 | comment | added | Nick | @FilipMilovanović no it can not. I will even be forced to remove this method, by different reason. But seems vtable call speed is good enought. | |
Oct 26 at 6:51 | comment | added | Filip Milovanović |
Is it possible to implement everything via map_range and remove map from the public interface? If that's feasible, then the problem goes away.
|
|
Oct 23 at 19:11 | comment | added | Christophe | Since modern CPUs are able to do branch prediction also for indirect calls, the performance difference is no longer substantial. | |
Oct 23 at 15:17 | review | Close votes | |||
Oct 28 at 3:03 | |||||
Oct 23 at 14:18 | vote | accept | Nick | ||
Oct 23 at 12:31 | comment | added | Nick | yes I did - user_map - fast enough :) , user_map_test = twice slow than user_map, CountReducer::map_range = about 10% faster than user_map. | |
Oct 23 at 12:24 | comment | added | Doc Brown | @Nick: I see you are here, writing comments, still did not reply to the two very first questions asked - so let me repeat this: have you measured the speed? If the answer is "no", the most sensible answer is probably "you are overthinking this". | |
Oct 23 at 12:18 | comment | added | Nick | @Caleth yes, it seems that way. I did it just for demonstration | |
Oct 23 at 12:16 | comment | added | Caleth |
Aside: Your example SumReducer counts it's input, it doesn't sum it
|
|
Oct 23 at 12:13 | answer | added | Caleth | timeline score: 3 | |
Oct 23 at 12:12 | comment | added | Bart van Ingen Schenau | What makes you think you can do a better job in optimizing those 100000 calls than the optimizer that works much closer to the CPU? Hoisting invariant instructions out of a loop is a very common optimization. | |
Oct 23 at 11:32 | answer | added | gnasher729 | timeline score: 0 | |
Oct 23 at 11:24 | comment | added | gnasher729 | Repeating that. Have you measured the speed? 100,000 virtual calls to the same implementation don’t take more than a millisecond. | |
Oct 23 at 11:20 | comment | added | JonasH | Have you done any profiling/benchmarking/measurements? | |
Oct 23 at 10:07 | history | asked | Nick | CC BY-SA 4.0 |