CPU 操作花费的时钟周期

OperationClock Cycles
Simple register-register op(ADD, OR)1
Memory write1
Bypass delay: switch between integer and floating-point units0 - 3
"Right" branch of "if"1 - 2
Floating-point/vector addition1 - 3
Multiplication(integer/float/vector)1 - 7
Return error and check1 - 7
L1 read3 - 4
TLB miss7 - 21
L2 read10 - 12
"Wrong" branch of "if"(branch misprediction)10 - 20
Floating-point division10 - 40
128-bit vector division10 - 70
Atomics/CAS15 - 30
C function direct call15 - 30
Integer division15 - 40
C function indirect call20 - 50
C++ virtual function call30 - 60
L3 read30 - 70
Main RAM read100 - 150
NUMA: different-socket atomics/CAS(guesstimate)100 - 300
NUMA: different-socket L3 read100 - 300
Allocation+Deallocation pair(small objects)200 - 500
NUMA: different-socket main RAM read300 - 500
Kernel call1000 - 1500
Thread context switch(direct costs)
C++ Exception thrown+caught
2000
5000 - 10000
Thread context switch(total costs, including cache invalidation)10000 - 1 million

Infographics: Operation Costs in CPU Clock Cycles - IT Hare on Soft.ware

Infographics: Operation Costs in CPU Clock Cycles

http://ithare.com/wp-content/uploads/part101_infographics_v08.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值