INPUT function: why is it slow? 
Author Message
 INPUT function: why is it slow?

I've opened a data file for input
        Open filename For Input As filenumber
and I am inputting lines of data (comma deliminated numbers) like
        Input #filenumber, number1, number2, number3,......, number16
where each line is sort of long with 16 number to input.

Anyway, there are several thousand lines of input.  I noticed that it's
taking "a lot" longer to input these numbers from the data file than it
took to write them to the data file.

Is there some particular reason why Input is so slow?  I've even tried
it out by just inputting the data and not using it (as opposed to
storing the number in an array... thinking the array storage and
expansion was the slow poke but, no, it's still slow).  Is there a way
to speep up the inputting?

Sincerely,
Dwight Bartholomew



Wed, 11 Jan 2006 05:46:20 GMT  
 INPUT function: why is it slow?

Quote:
> I've opened a data file for input
>         Open filename For Input As filenumber
> and I am inputting lines of data (comma deliminated numbers) like
>         Input #filenumber, number1, number2, number3,......, number16
> where each line is sort of long with 16 number to input.
> Anyway, there are several thousand lines of input.  I noticed that it's
> taking "a lot" longer to input these numbers from the data file than it
> took to write them to the data file.
> Is there some particular reason why Input is so slow?  I've even tried
> it out by just inputting the data and not using it (as opposed to
> storing the number in an array... thinking the array storage and
> expansion was the slow poke but, no, it's still slow).  Is there a way
> to speep up the inputting?

Well, you can use record files (Random Access) and move to any location in
the file at any time. In that way just input data as it's needed...


Wed, 11 Jan 2006 06:09:18 GMT  
 INPUT function: why is it slow?


Quote:
> I've opened a data file for input
>         Open filename For Input As filenumber
> and I am inputting lines of data (comma deliminated numbers) like
>         Input #filenumber, number1, number2, number3,......, number16
> where each line is sort of long with 16 number to input.

> Anyway, there are several thousand lines of input.  I noticed that it's
> taking "a lot" longer to input these numbers from the data file than it
> took to write them to the data file.

> Is there some particular reason why Input is so slow?

Without seeing the code there is no way to tell. In fact, the problem may
not be with the actual "INPUT" of the data, it may be, "what I do with the
data after I INPUT it."

Somewhere you have in your code something like:
WHILE NOT EOF(n)
  INPUT #n, varname
  (do something with varname)
WEND

The "do something with varname" may be where your actual delay is occurring.
Post this section of code and someone will be able to offer some 'speedup
tips.'

MCM



Wed, 11 Jan 2006 19:53:52 GMT  
 INPUT function: why is it slow?

Quote:
>I've opened a data file for input
>        Open filename For Input As filenumber
>and I am inputting lines of data (comma deliminated numbers) like
>        Input #filenumber, number1, number2, number3,......, number16
>where each line is sort of long with 16 number to input.

>Anyway, there are several thousand lines of input.  I noticed that it's
>taking "a lot" longer to input these numbers from the data file than it
>took to write them to the data file.

>Is there some particular reason why Input is so slow?  I've even tried
>it out by just inputting the data and not using it (as opposed to
>storing the number in an array... thinking the array storage and
>expansion was the slow poke but, no, it's still slow).  Is there a way
>to speep up the inputting?
>Sincerely,
>Dwight Bartholomew

You might try:
X$ = INPUT$(num[,[#]filenum]) where
num is the number of characters to retrieve from the file and filenum is the
file's number.
eg.
DEFINT A-Z
f = FREEFILE
OPEN "MYFILE.DAT" FOR INPUT AS #f
num% = 80
X$ = INPUT$(num%, # f )

num% can be up to 32767. The higher the
number the less reads your program will
require to get all the data. The downside is
that your program will have to split that data into a form it can use. The
technique will speed up file I/O.



Fri, 20 Jan 2006 14:29:15 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Why am I so Slow

2. File input slow - optimizations?

3. inputs via vbs in Excel is very, very slow when partsum assistent is used

4. Text Input Entry to TextBox is SO Slow

5. Barcode Scanner keyboard input slow in VB5

6. Is Input$ Really THAT Slow?

7. Slow, slow, slow search on VB6, ADO and SS7

8. VB4 is slow..slow....slow

9. Insert into SQL Server slow, slow, slow...

10. why am I getting this error??

11. Why am I losing html formatting?

12. Why am I getting this message?

 

 
Powered by phpBB® Forum Software