Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!snorkelwacker.mit.edu!paperboy!hsdndev!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.c Subject: Re: Execution time bottleneck: How to speed up execution? Message-ID: <24587:Feb1411:32:5391@kramden.acf.nyu.edu> Date: 14 Feb 91 11:32:53 GMT References: <4763@goanna.cs.rmit.oz.au> <17664:Feb1319:36:1291@kramden.acf.nyu.edu> <2934@charon.cwi.nl> Organization: IR Lines: 31 In article <2934@charon.cwi.nl> dik@cwi.nl (Dik T. Winter) writes: > This is ludicrious. Look, Richard's original took 15.6 seconds on a Sun, 14.2 with cc -O4, all with n = 1000. Mine took 15.0 seconds, 13.8 with cc -O4. That's a 4% speedup. On a Convex, Richard's took 3.91 without optimization, 3.03 with. Mine took 3.56 without, 2.72 with. That's a 10% speedup. With a fast exp I have lying around, the speedups become 33% and 52% respectively. (This exp uses four tables of size 65536 and does table lookup.) I made one mistake in my transformations: j should have been initialized to n - 1, not n, in the main loop. (Richard should have done the same thing, but he was properly defensive and used <= rather than !=. Oops.) That bug took me one minute to find. Writing the article in the first place took about fifteen minutes, most of that for explaining the transformations rather than doing them. Dik, take a step back and look at your contribution to this discussion. Who's trying to be more helpful, you or me? I'm saying ``Here are some optimizations. I hope you find them useful.'' You're saying ``Don't optimize your code. Even though you care about its speed enough to spend a few minutes asking the net for help, surely you don't think it's worth a few minutes of programming time to make it run noticeably faster.'' Why would anyone want to take that advice? ---Dan