Exactly how “fast” are modern CPUs?

后端 未结 15 2003
深忆病人
深忆病人 2020-12-23 22:41

When I used to program embedded systems and early 8/16-bit PCs (6502, 68K, 8086) I had a pretty good handle on exacly how long (in nanoseconds or microseconds) each instruct

15条回答
  •  Happy的楠姐
    2020-12-23 23:02

    It is nearly impossible to provide accurate timing information that you are expecting in a way that will be USEFUL to you.

    The following concepts affect instruction timing; some can vary from moment to moment:

    • Micro-op decomposition
    • Operation pipelining
    • Super-scalar execution
    • Out of order execution
    • SMT / SMP execution
    • Floating point mode
    • Branch prediction / pre-fetch
    • Cache latency
    • Memory latency
    • Clock speed throttling
    • etc

    Consult a book on modern computer architecture if you need any further explanation on the above concepts.

    The best way to measure the speed of your code is (surprise!) to measure the speed of your code running the same workload and under the same conditions as you expect it to when "in the real world".

提交回复
热议问题