Writing Fast Programs
Writing Fast Programs: A Practical Guide for Scientists and Engineers
Published by Cambridge International Science Publishing
PrefaceThis book is the culmination of much research in the quest to make a simple computational demo run fast enough to be useful. After many hours of reading and studying, and finally learning something about more efficient programming, I asked myself two questions: “Why are these techniques not universally employed in scientific and engineering codes?” and “Why is this information not in one place?”
In regard to the first question, I have, over the past twenty years, spent a fair amount of time working with my own small programs and the BASIC, C and ASSEMBLY source code of others. My comments in the book regarding inefficient practices in real code are most certainly not a criticism of those authors (how can I criticize those who did as I did?). Rather, in pointing these out in the text, I merely wished to show that slow techniques are used in real applications and there is room for improvement.
As for the second question, well, here it is. I don’t pretend this book to be the end-all of scientific code optimization. Quite the contrary; I could easily list a dozen things not covered. Further, there are additional examples that could have been given. This book focuses on Windows and Linux based PC’s, though the techniques are general, and can be applied to any platform. It was attempted to present the hardware specific material in a manner that is easily extended to other hardware.
I believe this book is a collection of practical tips, tricks and suggestions (Part II) with a firm foundation (Part I). I tried to pack as much useful information into this book as I could make relevant. In other words, I tried to write the book I needed five years ago.
Chapters 2 and 12 could be books in their own right. Therefore, with this material, I tried to hit the high spots. With these two chapters, the fine line between too long and enough material to make sense was quite elusive.
The demo results are presented for codes compiled with Visual Basic, Visual C++ (for Windows) and gcc for Linux. Some may question this choice of compilers (specifically, Visual Basic) for the demo results, but it was my hope to simply demonstrate that the techniques transcend language/compiler implementation and are general. In any case, I tried to provide demo versions to reach as wide an audience as possible.
Finally, it is my sincerest hope that you find this book useful in your code development efforts.
Return to Writing Fast Programs Summary Page
DSB Scientific Consulting . New Bern, NC . 803-413-4768 TEL
© DSB Scientific Consulting 2005-2014