home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!munnari.oz.au!ariel.ucs.unimelb.EDU.AU!ucsvc.ucs.unimelb.edu.au!lugb!lux!cscmd
- Newsgroups: comp.lang.pascal
- Subject: Re: Faster Pascal
- Message-ID: <1993Jan9.140610.28269@lugb.latrobe.edu.au>
- From: cscmd@lux.latrobe.edu.au (Mitch Davis)
- Date: Sat, 9 Jan 1993 14:06:10 GMT
- Sender: news@lugb.latrobe.edu.au (USENET News System)
- References: <mitchell.11@odie.ee.wits.ac.za>
- Organization: La Trobe University
- Lines: 55
-
- 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.
-
- I'm wondering just what sort of program you're running. As far as PC
- languages go, Turbo Pascal is no slouch. In fact, Turbo's speed is such
- that running your Pascal program on another platform even three times
- faster is highly unlikely to yield a three-fold improvement.
-
- Here's an example: At the moment I'm working on a program which reads
- email into a BBS message base. In Fidonet, the standard for transferring
- messages is in .PKT files. My program (written 95% in TP and 5% in BASM)
- will currently read and process 1 Meg of .PKTs (that's about 950 messages)
- in 14 seconds (on a 16MHz 386). [*]
-
- On my first version of the program, my main speed problem was the
- massive overhead each time you call DOS for some more of the file. It
- took me months of thinking to devise a way which still uses DOS calls,
- but avoids this enormous overhead.
-
- My point is, make sure the program you are running is running as
- efficiently as possible. If you have ANY heap left over, use it to
- build tables which will reduce computation. If you're doing any sort of
- data structure access (random OR sequential, in memory OR on disk),
- cache the last few elements accessed, so that you don't have to go
- seeking around for it, or writing to the same spot multiple times.
-
- These are two of the tricks I've found MOST useful lately, and it's
- tricks like these that can make the difference between wanting a faster
- machine, and swearing that the program is faulty because "there's no way
- the thing can be finished in that short amount of time!"
-
- >James Mitchell
-
- Mitchell James Davis.
-
- [*] Those involved in Fidonet might be interested. I'm writing this
- program because of the woeful performance and features of the programs
- used with TBBS. Currently, TMAIL takes about **95** minutes to import 3
- megabytes of mail into a 23 megabyte database, age old messages, keep
- quotas, export local messages, link subject headers, compress the
- database, and a few other jobs. My program which replaces and enhances
- TMAIL is currently doing the same job in **under** 7 minutes.
-
- I hope it sells. Otherwise I won't have any money to buy food this year!
-