Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411722 Posts in 69402 Topics- by 58455 Members - Latest Member: Sergei

May 22, 2024, 05:52:34 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Recommend me an optimization book
Pages: [1]
Print
Author Topic: Recommend me an optimization book  (Read 1291 times)
The Bag
Level 0
**


View Profile
« on: May 06, 2010, 01:20:20 PM »

Can anyone recommend a good C++ optimization book, preferably focussing on memory optimization.
Logged
BlueSweatshirt
Level 10
*****

the void


View Profile WWW
« Reply #1 on: May 06, 2010, 03:54:59 PM »

Simple:

Free all memory you don't need, don't create memory for things you don't need.

Viola.
Logged

nqe
Level 0
**


View Profile
« Reply #2 on: May 06, 2010, 08:34:43 PM »

Haven't read any books specifically on optimization, but Computer Systems, A Programmer's Perspective has a decently sized chapter on it. I haven't read that chapter specifically (it seems very assembly oriented) but I've read much of the book and I recommend it if you are interested in the inner workings of the OS.
Logged
Zaphos
Guest
« Reply #3 on: May 06, 2010, 10:23:25 PM »

Simple:

Free all memory you don't need, don't create memory for things you don't need.

Viola.
Sadly it's not that simple -- there's plenty more you could worry about when optimizing your memory usage.  For example, data structure alignment, data compression, ordering the data to maximize cache hits (eg tiling multidimensional arrays), traversing the data to maximize cache hits (eg traversing in a hilbert curve order), managing your own memory in a pool to avoid allocation overhead ...

I don't have any book recommendations, though, sorry Sad
Logged
Klaim
Level 10
*****



View Profile WWW
« Reply #4 on: May 07, 2010, 12:43:39 AM »

Fully read this : http://www.tantalon.com/pete/cppopt/main.htm

That's good advice and technics. Only the part on exception specification is not really right, so don't use exception specification. Avoid inline too if not really necessary and know your compiler behaviour.
Logged

Triplefox
Level 9
****



View Profile WWW
« Reply #5 on: May 07, 2010, 10:35:04 AM »

http://stackoverflow.com/questions/695222/code-optimization-bibles

Keep in mind that the architecture-related optimization information dates itself unbelievably fast; general-purpose techniques to do more with less memory(like the bitwise algorithms presented in Hacker's Delight) will retain their value much longer.
Logged

The Bag
Level 0
**


View Profile
« Reply #6 on: May 07, 2010, 03:51:25 PM »

Thanks guys, I'll check out those links.  I guess I should have been more specific with the memory comment, I did mean optimizing for cache hits, minimizing cycles spent fetching & branching.  It's all stuff I've done before, but I'm feeling kinda rusty, haven't hit it hardcore for a while, so I was wondering if there was any good books to brush up, this seems to be an area that's not well served.

Mike Acton's written some good stuff on this & the SCEE R&D page has the slides from a talk called Pitfalls of Object Oriented Programming which is also very good. 

(I've got my hands on a new toy at work, a good lua profiler so I'm going to town on out scripts at the moment Smiley)
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic