Nofal, Mostafa writes:
> Which is faster in I/O operation.
[omitted]
> In other words is reading the whole record and then assign its components to
> the various variables is faster than reading and writing these variables.
A real answer would be dependent on the specific compilers.
One might guess a slight edge to the more direct method, but only
testing would tell for sure.
But an even more real answer is probably that, in asking about which
is the fastest way to do list-directed formatted I/O, you are probably
asking the wrong question. Formatted I/O is almost always slow - my
very rough rule of thumb is about an order of magnitude slower that
unformatted. If speed is an issue, then perhaps you should be
rethinking your I/O strategy at a more fundamental level instead of
trying to tune the formatted I/O performance. As long as it is
formatted I/O, the comparison is always going to be between
"really slow" vs "really slow but a hair faster/slower". Fast isn't
likely to be an option.
--
Richard Maine | Good judgment comes from experience;
[log in to unmask] | experience comes from bad judgment.
| -- Mark Twain
|