lang@pegasus.cs.tulane.edu (Raymond Lang) (07/14/90)
I'm working on a text-based program for a client. The program was originally in BASIC, but I wanted to change it to Pascal to make future maintenance easier (I'm using Orca/Pascal). The program uses two data files, one of which is an index into the other. Here's where I get into problems. The Seek procedure was unacceptably slow when locating the file pointer. So I thought I'd just read the entire data file into a linked list of arrays and work like that. But it's taking over an HOUR to read in the file (it's about 200K). It takes about a second to read in each record from the data file (each record is a character string of length 60). Is this normal? Why does it take so long to do file access with Standard Pascal procedures? Would this be faster if it used toolbox routines? More to the point, is there a way to make it faster _without_ using toolbox routines? (I'd like to keep this as non-machine specific as I can so I can port it to a PC.) Thanks, Ray (lang@rex.cs.tulane.edu)
bchurch@oucsace.cs.OHIOU.EDU (Bob Church) (07/15/90)
In article <3860@rex.cs.tulane.edu>, lang@pegasus.cs.tulane.edu (Raymond Lang) writes: > > The program uses two data files, one of which is an index into the other. > Here's where I get into problems. The Seek procedure was unacceptably slow > when locating the file pointer. So I thought I'd just read the entire data > file into a linked list of arrays and work like that. But it's taking over > an HOUR to read in the file (it's about 200K). It takes about a second to > read in each record from the data file (each record is a character string > of length 60). > > Thanks, > Ray (lang@rex.cs.tulane.edu) I had a similar problem once and hope this helps. I don't know the specifics but there is a lot involved with reading text files. It's as if the OS were actually reading each line, checking for control codes etc. I changed the file type to binary which DOS (and I'm assuming other OS's) just reads in as a block of data. This is *MUCH* faster. You would need to set up a some sort of system for reading in the data and then pointing your arrays at it to then treat it as text. I realize this is extremely vague but hopefully it can help point you in the right direction. ******************************************************************** * * * bob church bchurch@oucsace.cs.ohiou.edu * * * * If economics isn't an "exact" science why do computers crash * * so much more often than the stock market? * * bc * ********************************************************************