[Gambas-user] What is faster: OPEN or File.Load?
Rolf-Werner Eilert
eilert-sprachen at ...221...
Mon May 30 15:30:10 CEST 2011
Am 30.05.2011 13:16, schrieb Ian Haywood:
> On Mon, May 30, 2011 at 6:47 PM, Rolf-Werner Eilert
> <eilert-sprachen at ...221...> wrote:
>
>> Well, I want both... First I simply need the complete list of names
>> (first line only), later I have to look into each file to find data. So
>> I will use both ways, thank you!
> Hmm, most of the time will be opening the file, so doing both may be the
> slowest solution as you are opening twice.
> If you eventually need to read in all the files, and you have enough
> RAM, best solution
> would be to read the lot using File.Load ()
> If you only read the rest of some files, then read the first line
> using OPEN and keep the file objects
> so you can read the rest without opening them a second time.
>
> Ian
That's a good idea :-) Although I must say that Linux has very good file
buffering. As soon as a file has been read once, it will take only
milliseconds to open and read it again, even with masses of files.
Anyway, this is a thing I'll keep in mind for next time when I have to
revamp the file and filtering functions. It could really help.
Rolf
More information about the User
mailing list