Currently I load a single file into a byte array using the code below.
Open "Data1.txt" For Binary Access Read As #69
ReDim DataBase(LOF(69) - 1)
Get #69, , DataBase()
Close #69
Now my objective is to append/load ANOTHER Data file to the array.
1. I want to avoid loops. (speed conscious)
2. I want to avoid using a secondary array. (the files are large)
Any ideas? Thanks in advance.
If you are really trying to be speed conscious, bypassing loops is not your solution. The solution would be to either use Random access to the file, or bypass VB and look into some disk IO API's. ReadFile, CreateFile, CloseHandle, SetFilePointer, might be something worth looking into.
Quote from: Tuberload on July 27, 2004, 03:26 PM
If you are really trying to be speed conscious, bypassing loops is not your solution. The solution would be to either use Random access to the file, or bypass VB and look into some disk IO API's. ReadFile, CreateFile, CloseHandle, SetFilePointer, might be something worth looking into.
I don't see how using Random access would help..
and I forgot all about APIs.
I already took a look at the ReadFile declaration and it looks promising.
Thanks.
Quote from: o.OV on July 27, 2004, 10:35 PMI don't see how using Random access would help..
Have you tested it? I did a test when I started helping Trust[e1] create his bots database and it was significantly faster than using Binary.
Quoteand I forgot all about APIs.
I already took a look at the ReadFile declaration and it looks promising.
Thanks.
Yes it is very promising. Hope it helps.
Quote from: Tuberload on July 28, 2004, 01:35 PM
Quote from: o.OV on July 27, 2004, 10:35 PMI don't see how using Random access would help..
Have you tested it? I did a test when I started helping Trust[e1] create his bots database and it was significantly faster than using Binary.
Did you load the database into memory or did you read a block at a time?
Quote from: o.OV on July 28, 2004, 10:48 PMDid you load the database into memory or did you read a block at a time?
The testing only involved loading an entire file into memory using Binary access, Random access, and the API calls.
A roughly 4.5 mb file took:
-> Binary: 18967ms to read into memory
-> Random: 751ms
-> API: 321ms
Wow, that's a huge difference. :-\