[Switch] Computer computing time comparison of addition, subtraction, multiplication, division

Source: Internet
Author: User
Tags intel pentium

From http://blog.sina.com.cn/s/blog_8b4181c701015mij.html

Intel Pentium CPU computing addition, subtraction, multiplication, division instructions

[Addition ]:

Instruction period

ADC register, count 1 immediately

ADC register, register 1

ADC register, memory 2

ADC memory, instant 3

ADC memory, register 3

 

Add register, count 1 immediately

Add register, register 1

Add register, memory 2

Add memory, instant count 3

Add memory, register 3

 

INC register 1

INC Memory 3

 

Subtraction ]:

Dec register 1

Dec Memory 3

 

Sub register, count 1 immediately

Sub register, register 1

Sub register, memory 2

Sub memory, instant count 3

Sub memory, register 3

 

SBB register, count 1 immediately

SBB register, register 1

SBB register, memory 2

SBB memory, instant count 3

SBB memory, register 3

 

[Multiplication ]:

Imul register 11

Imul memory 11

Imul register, register, count 10 immediately

Imul register, count 10 immediately

Imul register, memory, immediate count 10

Imul register, register 10

Imul register, memory 10

 

Mul 8-bit register 11

Mul 16-bit register 11

Mul 32-bit register 10

Mul 8-Bit Memory 11

Mul 16-Bit Memory 11

Mul 32-Bit Memory 10

 

[Division ]:

Div 8-bit register 17

Div 16-bit register 25

Div 32-bit register 41

Div 8-Bit Memory 17

Div 16-Bit Memory 25

Div 32-Bit Memory 41

 

Idiv 8-bit register 22

Idiv 16-bit register 30

Idiv 32-bit register 46

Idiv 8-Bit Memory 30

Idiv 16-Bit Memory 30

Idiv 32-Bit Memory 46

 

 

It can be seen that the speed of addition and subtraction for CPU computing is equivalent to that for bitwise operations (such as, or, non-, exclusive, or), and the speed of multiplication is nearly 10 times slower than that for addition and subtraction, division speed is slower than addition and subtraction (nearly 20 times -- 8 bits, nearly 30 times -- 16 bits, more than 40 times -- 32 bits ). Calculation and subtraction: The READ memory data is slower than the READ memory data, and the write memory is slower than the READ memory.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.