[comp.lang.modula2] Speed of Modula-2 I/O as compared to that of C

Mick.Deans@p482.f300.n202.z2.fidonet.org (Mick Deans) (05/24/90)

 > As C does not differentiate between text I/O and binary I/O,
 > you may use whichever is fastest in your Modula-2

Who says 'C' doesn't differentiate between text and binary I/O? I 
ran your code on 3 different compilers, and all showed a 15% 
differentiation between files opened i binary mode and files 
opened i text mode. fopen("tempfile", "rb"); 
fopen("tempfile","rt");

 At any rate, if I were interested i fast I/O, I'd be using (the 
standard library funtions) write()/read() for block I/O, instead 
of single character I/O.

 BTW, I agree with you that there should be no need for declaring 
variables as registers (if your disagree with your compiler; 
splice in some assembler). But, it's a fact that by tweeking my 
code a bit (with out using assembler or register decl.) I managed 
to halv the time taken to write and read a 300,000 character file 
(with single character I/O in binary mode), i.e from 21 seconds 
to 10 seconds (on a 386 PC with a 14.9 ms drive)

 Different jobs, different tools. 'C's strength is it's speed and 
portability, M2 has Pascal's readability and ease of maintence.

/Deans


--  
uucp: uunet!m2xenix!puddle!2!202!300.482!Mick.Deans
Internet: Mick.Deans@p482.f300.n202.z2.fidonet.org