home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.arch:10611 comp.lang.misc:3588
- Newsgroups: comp.arch,comp.lang.misc
- Path: sparky!uunet!spool.mu.edu!uwm.edu!daffy!snake38.cs.wisc.edu!lawrence
- From: lawrence@snake38.cs.wisc.edu (Thomas Lawrence)
- Subject: Re: Hardware Support for Numeric Algorithms
- Message-ID: <1992Nov11.145718.24305@daffy.cs.wisc.edu>
- Sender: news@daffy.cs.wisc.edu (The News)
- Organization: /usr/lib/news/rn/organization
- References: <1992Nov5.202412.7266@linus.mitre.org> <1992Nov10.153705.27804@yrloc.ipsa.reuter.COM> <1992Nov11.100555.4706@smds.com>
- Date: Wed, 11 Nov 1992 14:57:18 GMT
- Lines: 28
-
- Well, I can't speak for anyone other than me, but here is a technique I
- find useful when I have to develop code that runs screamingly fast yet is
- rather complex when "optimized" by hand.
-
- First, I develop some working algorithm that's SIMPLE enough to understand
- by looking at it. This means it has absolutely no performance helpers.
- (No caches, hash tables, etc.) I debug that code to make sure it works
- properly (basically debugging my algorithm, and not worrying about any
- optimizations). [Note that there may be goto's in the code; I don't
- deal with that. I've gotten into the habit of using them instead of
- do-while loops in some cases.]
-
- THEN I go and put COMMENTS around the entire code so that the compiler
- won't see it. I use the simple code as guidelines for developing more
- efficient code.
-
- The end result is a source file containing
- - Some straight-forward but inefficient code which is enclosed in comments
- so that when I come back 3 months from now, I can use it to see what I
- was trying to do.
- - Some twisted, optimized code (with comments indicating what was done
- to it from the original model, so I can fix it 3 months from now).
-
- If it happens that I have to scrap the optimized code in a few months because
- I forgot what it did, that's ok because I still have the original working
- version in the text file which I can modify as necessary. Or if I want
- I can modify the optimized version. It leaves the options open.
-
-