UnThreaded | Threaded | Whole Thread (11) | Ignore Thread Prev | Next
Author: JeanDavid Big gold star, 5000 posts Old School Fool Add to my Favorite Fools Ignore this person (you won't see their posts anymore) Number: of 1648  
Subject: Re: Rare bird Date: 12/12/2011 3:24 PM
Post New | Post Reply | Reply Later | Create Poll . Report this Post | Recommend it!
Recommendations: 1
To be more clear, I don't think this was caused by a code optimizer. I suspect it was a programmer's optimization at the source code level.

In C, you can specify that a small number of variables can be kept in registers. Our optimizer would generally ignore these, because programmers were almost always wrong in their allocation of variables to registers. Furthermore, there was no good way to assign multiple variables to the same register because you would need some way to the live-dead analysis and even if you did, there was no practical syntax for telling the compiler about it. Much better to have the optimizer do it.

But our optimizer build flow graphs of programs, did live-dead analysis of variables, etc., so we could tell much better than the programmer, who seldom had even profiled his program, and surely would not have the patience to do all the analysis our optimizer did. The acid test was always to take his code untouched by our optimizer and compare it to the code we optimized. They seldom believed the test results.

The trouble with optimizing the code by hand is that is usually done locally, when it is the global optimizations that really matter. An increase in program and data locality will, on modern machines, improve execution speed much more than speeding up the loop in strcpy() function, for example.

If you really want to optimize code, especially C code, by hand, read Jon Bentley's book on Writing Efficient Programs.
Post New | Post Reply | Reply Later | Create Poll . Report this Post | Recommend it!
Print the post  
UnThreaded | Threaded | Whole Thread (11) | Ignore Thread Prev | Next

Announcements

Pencils of Promise - Back to School Drive
"Pencils of Promise works with communities across the globe to build schools and create programs that provide education opportunities for children."
Managing Your Wealth
Our own TMFHockeypop from Rule Your Retirement fame on the TV show Managing Your Wealth.
When Life Gives You Lemons
We all have had hardships and made poor decisions. The important thing is how we respond and grow. Read the story of a Fool who started from nothing, and looks to gain everything.
Post of the Day:
Value Hounds

Mobileye's Growth too Hot?
What was Your Dumbest Investment?
Share it with us -- and learn from others' stories of flubs.
Community Home
Speak Your Mind, Start Your Blog, Rate Your Stocks

Community Team Fools - who are those TMF's?
Contact Us
Contact Customer Service and other Fool departments here.
Work for Fools?
Winner of the Washingtonian great places to work, and "#1 Media Company to Work For" (BusinessInsider 2011)! Have access to all of TMF's online and email products for FREE, and be paid for your contributions to TMF! Click the link and start your Fool career.
Advertisement