home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!munnari.oz.au!bunyip.cc.uq.oz.au!uqcspe!cs.uq.oz.au!muzzle
- From: muzzle@cs.uq.oz.au (Murray Chapman)
- Newsgroups: comp.lang.pascal
- Subject: Re: Faster Pascal
- Message-ID: <11625@uqcspe.cs.uq.oz.au>
- Date: 11 Jan 93 00:42:42 GMT
- References: <mitchell.11@odie.ee.wits.ac.za> <1993Jan9.140610.28269@lugb.latrobe.edu.au>
- Sender: news@cs.uq.oz.au
- Reply-To: muzzle@cs.uq.oz.au
- Lines: 47
-
- In <1993Jan9.140610.28269@lugb.latrobe.edu.au> cscmd@lux.latrobe.edu.au (Mitch Davis) writes:
-
- >In article <mitchell.11@odie.ee.wits.ac.za> mitchell@odie.ee.wits.ac.za (MITCHELL JAMES) writes:
- >>G'day all!
- >>
- >>Bascially, I'm trying to find a way to run Pascal code faster. I have access
- >>to a 486 but this is woefully inadequate (for my needs at least).
-
- >Hi there James!
-
- >>If anyone has experienced/solved the speed problem, I would greatly
- >>appreciate their advice.
-
- >I've had that problem, and I've solved it. 90% of the time, you can
- >triple the speed of your program by re-writing it so it is smarter.
-
- This is true.
-
- Also, it's pretty well-known that on average, your computer spends 90% of
- its time in 10% of the program. In other words, there is no point in
- trying to optimize statements that aren't executed multiple times.
-
- For example:
-
- 1: R := R * 4;
- 2: for x := 1 to 100 do
- 3: for y := 1 to 100 do
- 4: line(0, 0, Sin(X) * R, Sin(Y) * R);
-
- There would not be much point in changing line 1 to assembler code to do two
- ASL's, as the speedup would be linear, and not all that much.
-
- On the other hand, line 4 is executed 10000 times, and calls 20000 expensive
- functions. Make a lookup table for sin/cos, and you will save yourself 20000
- function calls.
-
- >>James Mitchell
-
- >Mitchell James Davis.
-
- Cheers,
- Murray
- --
- ~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^
- Murray Chapman muzzle@cs.uq.oz.au
- University of Queensland How many lightbulb jokes does it
- Brisbane, Australia take to change the subject?
-