使用手机摄像头 - 扫描以下代码并下载 Kindle 阅读软件。
The Art of Writing Efficient Programs: An advanced programmer's guide to efficient hardware utilization and compiler optimizations using C++ examples (English Edition) Kindle电子书
Become a better programmer with performance improvement techniques such as concurrency, lock-free programming, atomic operations, parallelism, and memory management
- Learn proven techniques from a heavyweight and recognized expert in C++ and high-performance computing
- Understand the limitations of modern CPUs and their performance impact
- Find out how you can avoid writing inefficient code and get the best optimizations from the compiler
- Learn the tradeoffs and costs of writing high-performance programs
The great free lunch of "performance taking care of itself" is over. Until recently, programs got faster by themselves as CPUs were upgraded, but that doesn't happen anymore. The clock frequency of new processors has almost peaked, and while new architectures provide small improvements to existing programs, this only helps slightly. To write efficient software, you now have to know how to program by making good use of the available computing resources, and this book will teach you how to do that.
The Art of Efficient Programming covers all the major aspects of writing efficient programs, such as using CPU resources and memory efficiently, avoiding unnecessary computations, measuring performance, and how to put concurrency and multithreading to good use. You'll also learn about compiler optimizations and how to use the programming language (C++) more efficiently. Finally, you'll understand how design decisions impact performance.
By the end of this book, you'll not only have enough knowledge of processors and compilers to write efficient programs, but you'll also be able to understand which techniques to use and what to measure while improving performance. At its core, this book is about learning how to learn.
What you will learn
- Discover how to use the hardware computing resources in your programs effectively
- Understand the relationship between memory order and memory barriers
- Familiarize yourself with the performance implications of different data structures and organizations
- Assess the performance impact of concurrent memory accessed and how to minimize it
- Discover when to use and when not to use lock-free programming techniques
- Explore different ways to improve the effectiveness of compiler optimizations
- Design APIs for concurrent data structures and high-performance data structures to avoid inefficiencies
Who this book is for
This book is for experienced developers and programmers who work on performance-critical projects and want to learn new techniques to improve the performance of their code. Programmers in algorithmic trading, gaming, bioinformatics, computational genomics, or computational fluid dynamics communities will get the most out of the examples in this book, but the techniques are fairly universal. Although this book uses the C++ language, the concepts demonstrated in the book can be easily transferred or applied to other compiled languages such as C, Java, Rust, Go, and more.
Table of Contents
- Introduction to Performance and Concurrency
- Performance Measurements
- CPU Architecture, Resources, and Performance Implications
- Memory Architecture and Performance
- Threads, Memory, and Concurrency
- Concurrency and Performance
- Data Structures for Concurrency
- Concurrency in C++
- High-Performance C++
- Compiler Optimizations in C++
- Undefined Behavior and Performance
- Design for Performance
- ASIN : B09BZTGJM2
- 出版社 : Packt Publishing; 第 1st 版 (2021年10月22日)
- 出版日期 : 2021年10月22日
- 语言 : 英语
- 文件大小 : 16045 KB
- 标准语音朗读 : 已启用
- X-Ray : 未启用
- 生词提示功能 : 未启用
- 纸书页数 : 464页
- > ISBN : 1800208111
- 亚马逊热销商品排名: 商品里排第44,007名Kindle商店 (查看商品销售排行榜Kindle商店)
|5 星 (0%)||0%|
|4 星 (0%)||0%|
|3 星 (0%)||0%|
|2 星 (0%)||0%|
|1 星 (0%)||0%|
By the middle of the first chapter, I was pretty thoroughly disabused of that hubris. Fedor G. Pikus is a real heavyweight in this field. I don't know if he has an advanced degree -- he doesn't list one -- but I would imagine that he is one of those folks who has just been too busy to pursue one. He's got a list of publications and research papers that spans several pages of web search hits.
Mr. Pikus did an incredible job with this book. He explains some counter-intuitive concepts with a straightforward clarity that left me somewhat embarrassed with how little I knew, and how much I just took for granted because somebody just told me to do something in a particular way at some point in my career. And there were some things that I *did* know, but he explained in a way much better than I had seen before.
It's not an easy read. In order to get the most out of this book, you have really go through every example very carefully. Fortunately, the examples use tools that are readily available in the open-source world.
While I still think that choice of algorithm dwarfs all other considerations combined, Mr. Pikus showed that the choice of the most appropriate algorithm is not always obvious, sometimes for very obscure reasons. So, how does one choose? Pikus demonstrated the use of several tools that can help.
Unfortunately for me, I'm working in an environment where the actual target hardware and OS is not yet available, so I have to rely on simulations which might be sub-optimal. But I expect that when I do get to the point in this project that I get to test with the actual target system, that this book will come in handy. It is well organized, and will be a useful reference.
In summary, this is one of the best-written books on this subject that I have seen to date.
Mr. Pikus has enviable credentials and experience that make him an authoritative voice on code optimization. Pikus has worked on the largest computational problems, where efficiency, utilization, and power consumption all factor into performance. His writing style is engaging, though marred by careless copy-editing by Packt.
I love Pikus’ lucid explanation, including how the compiler knows to perform the Return Value Optimization, and how the compiler uses Undefined Behavior to improve code. He speaks knowledgeably about lock-free concurrency and atomic operations. Pikus has an amazing understanding of how CPU micro-architecture influences efficiency, and can demonstrate what he says with benchmarks. His clear explanations of the workings of perftools and his approach to probing micro-architecture would be an accessible introduction for a developer interested in machine-dependent optimization. Clearly, Pikus knows his compiler and his micro-architecture.
Unfortunately, "Art" is disappointing in several ways. While I liked the book, my relatively low 3-star rating reflects these weaknesses.
While the book gives lip service to the slippery, multidimensional quantity called performance, the tools Pikus uses and the results he presents measure local code efficiency only. The book claims to offer advice for many programming languages, but all Pikus’ examples are C++, and he discusses many C++ optimizations that don’t even apply to other languages. Similarly, Pikus only talks about Linux performance measuring tools and compilers, though Windows tools are of course similar in outline. His discussion of micro-architecture is specific to processors like the x86. So despite the big promises in the introduction, this is really a book on local optimization of C++ code running on x86 Linux systems.
Pikus starts by ruling out any discussion of algorithms, making the valid point that a comprehensive discussion of algorithms would be a project of vast scope. I think this is unfortunate, since in my experience the largest efficiency gains come from improving algorithms. His coverage of data structures is also limited, which is unfortunate because they can have a significant effect on performance.
Pikus’ writing style is stream-of-consciousness. There is plenty to learn by carefully reading through this book, even for experienced developers, but not so many specific, actionable recommendations for optimizing code. Much of the material is merely tutorial, though well-explained. The table of contents is organized around broad computational categories, and the index is sparse. Packt’s compressed, two-column table of contents style, with breaks across pages, is confusing. Readers will struggle to use "Art" as a reference book. Books from Packt have a formal structure with copious introductory material, summary material, and problem sets. It is not the author’s fault if all this boilerplate seems long-winded.
Am I glad I read "The Art of Writing Efficient Programs?" Yes, absolutely. Would I be just as glad if I had paid 40 bucks for it and was in a hurry to get something useful out of it? Maybe not so much.