🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #735

Speed of Modula-2 I/O as compared to that of C

#735
From: Mick Deans
Date: Wed, 23 May 1990 18:26
31 lines
1755 bytes
 > 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
Technical Details
Message-ID: <6531.26637597@puddle.fidonet.org>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!ogicse!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!puddle!p482.f300.n202.z2.fidonet.org!Mick.Deans

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!ogicse!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!puddle!p482.f300.n202.z2.fidonet.org!Mick.Deans
From: Mick.Deans@p482.f300.n202.z2.fidonet.org (Mick Deans)
Newsgroups: comp.lang.modula2
Subject: Speed of Modula-2 I/O as compared to that of C
Message-ID: <6531.26637597@puddle.fidonet.org>
Date: 23 May 90 18:26:24 GMT
Sender: ufgate@puddle.fidonet.org (newsout1.26)
Organization: FidoNet node 2:202/300.482 - East SAN DIEGO, San Diego CA
Lines: 31