in reply to Re^2: For- loop increment not passing to inner block
in thread For- loop increment not passing to inner block
If the file in question is not very big (e.g. less than, say, 50 MB on typical desktop machines of the last few years), and you have some reason to prefer your current ordering of the loops, it would be better to read the whole file content into a memory-resident array first, then use a nested "for" loop over that array, rather than repeating your "while" loop over the file contents.
The point is that file i/o is quite slow relative to memory-internal operations, so reading data from a file just once (rather than five times) just makes more sense.
|
|---|