Skip to Content
算法技术手册(原书第2 版)
book

算法技术手册(原书第2 版)

by George T.Heineman, Gary Pollice, Stanley Selkow
August 2017
Intermediate to advanced
360 pages
8h 35m
Chinese
China Machine Press
Content preview from 算法技术手册(原书第2 版)
40
3
以一般都需要考虑浮点和整数运算的性能差异来优化程序。不过,相对于整数运算,
CPU
已经在浮点运算上做了大量的改进和优化,即便如此,当需要使用浮点计算时,
开发人员还是需要注意这些问题(
Goldberg
1991
)。
3.4.1 性能
一个广为接受的观点是整数运算会比浮点运算高效得多。表
3-1
列出了在高端计算机上
进行
10 000 000
次计算的时间,这些结果包含了本书
1
中在
Linux
平台上的结果
还有一台
1996
年的
Sparc Ultra-2
的结果。可以看到,单个操作的性能在不同平台上的
差异很大。而且从这些结果中,可以很明显地看出在过去
20
年左右处理器在性能上的
巨大改进。有些结果之所以
0.0000
是因为它们比现有的计时器还要快。
3
-
1
10
000
000
次操作的性能
操作 Sparc Ultra-
2
/s Linux i
686
/s 现代计算机/s
32
32 位整数 CMP 0.811 0.0337 0.0000
32 位整数 MUL 2.372 0.0421 0.0000
32 位单精度浮点数 MUL 1.236 0.1032 0.02986
64 位双精度浮点数 MUL 1.406 0.1028 0.02987
32 位单精度浮点数 DIV 1.657 0.1814 0.02982
64 位双精度浮点数 DIV 2.172 0.1813 0.02980
128 位双精度浮点数 MUL 36.891 0.2765 0.02434
32 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

机器学习实战:基于Scikit-Learn、Keras 和TensorFlow (原书第2 版)

Aurélien Géron
Go语言编程

Go语言编程

威廉·肯尼迪

Publisher Resources

ISBN: 9787111562221