ACCU Home page ACCU Conference Page
Search Contact us ACCU at Flickr ACCU at GitHib ACCU at Google+ ACCU at Facebook ACCU at Linked-in ACCU at Twitter Skip Navigation

Search in Book Reviews

The ACCU passes on review copies of computer books to its members for them to review. The result is a large, high quality collection of book reviews by programmers, for programmers. Currently there are 1918 reviews in the database and more every month.
Search is a simple string search in either book title or book author. The full text search is a search of the text of the review.
    View all alphabetically
Title:
Optimizing C++
Author:
Steve Heller
ISBN:
0 13 977430 0
Publisher:
Prentice Hall
Pages:
pp416C
Price:
£35-99
Reviewer:
Francis Glassborow
Subject:
beginner's c++; optimization
Appeared in:
11-2
Despite quite liking the author'sWhose Afraid of C++I have long harboured a suspicion that he is not a C++ programmer. This book confirms that suspicion despite the C++ in the title. For example on page 356 the author starts a version of main that covers three and a half pages (and there is a single comment - one of the author's optimisations seems to be to save time by not providing any). The function starts by declaring 26 variables, most are not initialised and 24 of them are for built-in types (or pointers to such). He defines at least another 14 variables during the rest of the program. He makes unnecessary assumptions about the size of an int (if it cannot store 884736 as a value, one of his loops goes into undefined behaviour).

All that is bad but the biggest indicator is that the only C++ specifics in his code are an ifstream instance, an ofstream instance, four uses of new and one use of delete and a scattering of uses of fstream member functions. He isn't even consistent. Sometimes he uses memset() and sometimes he iterates through an array of int setting each to zero. He does this in a loop that iterates 884736 times and he is writing about optimisation. Granted that the gain may be small but why did he do it that way in side a time critical section and used memset() elsewhere. We will never know. Perhaps a good optimising compiler identifiers what is happening and sets memory anyway.

The other problem that I have is the very concept that underlies the book. Too many programmers waste inordinate amounts of time hand optimising. To give the author credit, he does advise you to think before starting to work. If you run your tax program once a year, halving it execution time is unlikely to ever repay the programming effort involved in making the change.

However the most expensive resources in most programming projects are the human ones and the coding style that permeates this book does nothing to optimise use of that resource. In truth I think your time could be put to better advantage than in reading this book.

By the way, the author seems to think this is his third edition of this book. I think he means that it is derived from an earlier book that was itself derived from a book in C. In my opinion this is still a book in C with a light sprinkling of C++ (he even uses some smart pointers, but he forgets toprovide a destructor for class that owns dynamic resources.) In conclusion, there are a few interesting ideas scattered through this book but not enough to repay time spent studying it.