On Thu, 07 Apr 2011 16:45:10 -0400, Sam Siegel <[email protected]> wrote:
Look at the IPA and Profile directed optimization available to the C/C++ compiler. These features do exactly what you describe.
These look pretty cool. I'd say that PDF is closer to being able to get the out of band "knowledge" that I was talking about. Still, it seems like it could be a lot of trouble building the sample runs to get the profiles right, especially for interactive applications or for complex multi-threading apps. Whereas, when I'm writing code, I usually just know which parts of code are like to be heavily hit in production so I code it right as I go along. Presumably, an HLL could be written (and probably already exists) where programmers can give explicit or implicit hints to the compiler that an assembler programmer doesn't have to to make the code more efficient. This would also remove some/all of the assembler coder's edge. In any case, I'm not a huge advocate of assembler. If I could write the system I work with from scratch I certainly would not write it in assembler. I suspect that it would not be markedly slower if written in C though, like Ed, I'm suspicious of claims that it will run faster and have rarely seen such claims pan out. Maybe IPA and PDF would make it so but I remain skeptical (though obviously, if you're serious about optimizing your C code, you should use these tools). Of course one problem in this debate is that it's exceedingly difficult/expensive to run a truly fair and interesting comparison. There's just no way to control for all the variables. People will claim they have but since any comparison will involve an assembler programmer and a C (or other HLL) programmer (making it the same person doesn't really solve the problem) there's a massive human element in any comparison that probably overwhelms all other factors. -- Cheers, Alex Kodat Sirius Software
