|
|
|
|
|
by exDM69
3253 days ago
|
|
Virtual function calls can be expensive, just compare the out-of-the-box performance between std::sort (c++, no virtual calls) and qsort (c, "virtual call" via function pointer). This can make a 10x difference when sorting something trivial (e.g. integer array). std::sort will compile to a single instruction for the comparison, qsort will typically have to do a full virtual function call, not expensive by itself but still significantly worse than single integer comparison instruction. |
|