g*c 发帖数: 4510 | 1 一个type有一百个level,就是说parent和grandparent有100个level
一个type有两个level
这两个type的performance会怎样
我回答是create是perf有差别,用起来没差别
然后面试官就提到了CPU L1 L2 cache和pointer jump,我想了一下,回答说因为都是
Derived type,所以用起来还是没差别。
不知道有没有miss了什么?请高人指点。多谢! |
x*****z 发帖数: 15 | 2 http://www.learncpp.com/cpp-tutorial/125-the-virtual-table/
So it looks like cache performance could be different, depending on how many
vtable have to be accessed. Like 100 functions implemented in 100 levels vs
in 2 levels. Not sure tough. |
g*c 发帖数: 4510 | 3 应该是证明了我答的没错
many
vs
【在 x*****z 的大作中提到】 : http://www.learncpp.com/cpp-tutorial/125-the-virtual-table/ : So it looks like cache performance could be different, depending on how many : vtable have to be accessed. Like 100 functions implemented in 100 levels vs : in 2 levels. Not sure tough.
|
g*c 发帖数: 4510 | 4 多谢,应该是证明了我答的没错
many
vs
【在 x*****z 的大作中提到】 : http://www.learncpp.com/cpp-tutorial/125-the-virtual-table/ : So it looks like cache performance could be different, depending on how many : vtable have to be accessed. Like 100 functions implemented in 100 levels vs : in 2 levels. Not sure tough.
|
r***0 发帖数: 406 | 5 I may think you (LZ) are wrong. With the 100 levels, the instruction cache
won't work well for prefetch. The instruction stream prefetch usually works
at PC incr or PC decr two directions. But if the derived type pointer
chasing to 100 different target, I think the cache performance will drop.
Please update if you figure out the answer.
【在 g*c 的大作中提到】 : 多谢,应该是证明了我答的没错 : : many : vs
|