Re: [vox-tech] a comment on Pete's fast-loop question
On Sun, Jun 18, 2006 at 11:44:19PM -0400, Peter Jay Salzman wrote: On Sun 18 Jun 06, 8:13 PM, Micah J. Cowan [EMAIL PROTECTED] said: Given your explanation above, you might also find Hacker's Delight to be enjoyable reading (if you haven't read it already). ...just promise me you'll document the hell out of pretty much anything you /use/ out of there... :-) You know... a long time ago I read a /. book review of this book and it's been in the back of my head for a long time. I never had the money to purchase it (I think it's still on my nerdbooks.com wishlist). You just reminded me of it. Yeah, that's a book I can afford now; I think I'll take the plunge. I set up a wiki on www.dirac.org/programming to document everything I learn about programming, numerics, and numerical algorithms. Slowly but surely, a lot of my saved vox-tech messages (like this one) are getting documented there. I also plan on documenting things I learn from books like Hacker's Delight. I should also point out that it may be unwise to implement some of the operations that book describes, that are already easily supported through more conventional means. For instance: the book may have some neat tricks for integer division, but the truth is that optimizing such things is the compiler's job, and sometimes the compiler will know better ways to do it (especially down the road in the future). Simpler code is frequently the best approach, no matter what cool tricks you know. Some things, OTOH, such as bit-counting, or other properties of a value-type evaluations, are much enhanced by exactly these sorts of tricks. -- Micah J. Cowan Programmer, musician, typesetting enthusiast, gamer... http://micah.cowan.name/ ___ vox-tech mailing list vox-tech@lists.lugod.org http://lists.lugod.org/mailman/listinfo/vox-tech
[vox-tech] a comment on Pete's fast-loop question
Pete Salzman asked about optimizing a loop in terms of execution speed, by having the loop index go from high value to low instead of vice versa. Some discussion ensued in terms of what machine instructions a compiler could take advantage of in this manner. One point that you might consider, Pete, is that these considerations are kind of nickel-and-dime in comparison to things like memory hierarchy issue. There is much better payoff potential in writing code in such a way as to minimize cache misses, which cause major time penalties, and page faults, which cause catastrophic time penalties. There is even a book on this, I believe in the Intel Press series. Norm ___ vox-tech mailing list vox-tech@lists.lugod.org http://lists.lugod.org/mailman/listinfo/vox-tech
Re: [vox-tech] a comment on Pete's fast-loop question
On Sun 18 Jun 06, 12:06 AM, Norm Matloff [EMAIL PROTECTED] said: Pete Salzman asked about optimizing a loop in terms of execution speed, by having the loop index go from high value to low instead of vice versa. Some discussion ensued in terms of what machine instructions a compiler could take advantage of in this manner. One point that you might consider, Pete, is that these considerations are kind of nickel-and-dime in comparison to things like memory hierarchy issue. There is much better payoff potential in writing code in such a way as to minimize cache misses, which cause major time penalties, and page faults, which cause catastrophic time penalties. Yeah, I know. My company hired me for algorithmic optimizations --- my knowledge of devising a set of algorithms to accomplish a given task (e.g., solving dense matrices, choosing a particular Monte Carlo for a given problem). I guess my attitude towards this was more along the lines of while I'm in the neighborhood, why don't I stop by and say hello. It certainly wouldn't be prudent to re-implement code to use nickel and dime optimization, but while thoughts in my neurons travel down my CNS and translate into my fingers tapping on keys, I might as well tap on keys in such a way that the nickel and dime optimizations appear on vim's terminal. The price of admission is free, so I might as well. OK. I took that nutty metaphor as far as it can go. Hope it made sense. There is even a book on this, I believe in the Intel Press series. Definitely sounds like a book I should pick up. I'll Google for it! Thanks, Pete ___ vox-tech mailing list vox-tech@lists.lugod.org http://lists.lugod.org/mailman/listinfo/vox-tech
Re: [vox-tech] a comment on Pete's fast-loop question
On Sun, Jun 18, 2006 at 08:26:21PM -0400, Peter Jay Salzman wrote: On Sun 18 Jun 06, 12:06 AM, Norm Matloff [EMAIL PROTECTED] said: Pete Salzman asked about optimizing a loop in terms of execution speed, by having the loop index go from high value to low instead of vice versa. Some discussion ensued in terms of what machine instructions a compiler could take advantage of in this manner. One point that you might consider, Pete, is that these considerations are kind of nickel-and-dime in comparison to things like memory hierarchy issue. There is much better payoff potential in writing code in such a way as to minimize cache misses, which cause major time penalties, and page faults, which cause catastrophic time penalties. Yeah, I know. My company hired me for algorithmic optimizations --- my knowledge of devising a set of algorithms to accomplish a given task (e.g., solving dense matrices, choosing a particular Monte Carlo for a given problem). I guess my attitude towards this was more along the lines of while I'm in the neighborhood, why don't I stop by and say hello. It certainly wouldn't be prudent to re-implement code to use nickel and dime optimization, but while thoughts in my neurons travel down my CNS and translate into my fingers tapping on keys, I might as well tap on keys in such a way that the nickel and dime optimizations appear on vim's terminal. The price of admission is free, so I might as well. OK. I took that nutty metaphor as far as it can go. Hope it made sense. There is even a book on this, I believe in the Intel Press series. Definitely sounds like a book I should pick up. I'll Google for it! Given your explanation above, you might also find Hacker's Delight to be enjoyable reading (if you haven't read it already). ...just promise me you'll document the hell out of pretty much anything you /use/ out of there... :-) -- Micah J. Cowan Programmer, musician, typesetting enthusiast, gamer... http://micah.cowan.name/ ___ vox-tech mailing list vox-tech@lists.lugod.org http://lists.lugod.org/mailman/listinfo/vox-tech
Re: [vox-tech] a comment on Pete's fast-loop question
On Sun 18 Jun 06, 8:13 PM, Micah J. Cowan [EMAIL PROTECTED] said: On Sun, Jun 18, 2006 at 08:26:21PM -0400, Peter Jay Salzman wrote: On Sun 18 Jun 06, 12:06 AM, Norm Matloff [EMAIL PROTECTED] said: Pete Salzman asked about optimizing a loop in terms of execution speed, by having the loop index go from high value to low instead of vice versa. Some discussion ensued in terms of what machine instructions a compiler could take advantage of in this manner. One point that you might consider, Pete, is that these considerations are kind of nickel-and-dime in comparison to things like memory hierarchy issue. There is much better payoff potential in writing code in such a way as to minimize cache misses, which cause major time penalties, and page faults, which cause catastrophic time penalties. Yeah, I know. My company hired me for algorithmic optimizations --- my knowledge of devising a set of algorithms to accomplish a given task (e.g., solving dense matrices, choosing a particular Monte Carlo for a given problem). I guess my attitude towards this was more along the lines of while I'm in the neighborhood, why don't I stop by and say hello. It certainly wouldn't be prudent to re-implement code to use nickel and dime optimization, but while thoughts in my neurons travel down my CNS and translate into my fingers tapping on keys, I might as well tap on keys in such a way that the nickel and dime optimizations appear on vim's terminal. The price of admission is free, so I might as well. OK. I took that nutty metaphor as far as it can go. Hope it made sense. There is even a book on this, I believe in the Intel Press series. Definitely sounds like a book I should pick up. I'll Google for it! Given your explanation above, you might also find Hacker's Delight to be enjoyable reading (if you haven't read it already). ...just promise me you'll document the hell out of pretty much anything you /use/ out of there... :-) You know... a long time ago I read a /. book review of this book and it's been in the back of my head for a long time. I never had the money to purchase it (I think it's still on my nerdbooks.com wishlist). You just reminded me of it. Yeah, that's a book I can afford now; I think I'll take the plunge. I set up a wiki on www.dirac.org/programming to document everything I learn about programming, numerics, and numerical algorithms. Slowly but surely, a lot of my saved vox-tech messages (like this one) are getting documented there. I also plan on documenting things I learn from books like Hacker's Delight. Thanks for reminding me of this book! Pete ___ vox-tech mailing list vox-tech@lists.lugod.org http://lists.lugod.org/mailman/listinfo/vox-tech