Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site abnjh.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!abnjh!cbspt002 From: cbspt002@abnjh.UUCP (Marc E. Kenig ) Newsgroups: net.lang Subject: Re: Slow Fortran I/O (VMS format 'compilation') Message-ID: <729@abnjh.UUCP> Date: Sat, 7-Jul-84 20:27:52 EDT Article-I.D.: abnjh.729 Posted: Sat Jul 7 20:27:52 1984 Date-Received: Sun, 8-Jul-84 00:34:55 EDT References: <9625@lanl-a.UUCP> <5884@mcvax.UUCP>, <2078@rlgvax.UUCP> Organization: ATTIS, NJ Lines: 38 <3Hbug> So far as I know, the VMS FORTRAN-77 compiler only checks syntax of the FORMAT statement's data descriptors. The format string is interpreted at runtime. VMS also allows variable repeat and accuracy qualifiers in format statements, which of course requires interpreting. (You put a program vble. in angle brackets in place of the constant as in: FORMAT(X,TR,F.3) which evaluates the current values of VAR1, VAR2, and VAR3, CHECKS THEM FOR LEGALITY (>=1 and w&d in F, E, and G formats sane, etc), and interprets that as the format to be printed). This handy feature eliminates the need for building format specifications via internal files (ENCODE for you F-IV, V, and F66 folks). (If C had a similar feature, it would nuke the need for lots of sprintf's I'd bet!). This feature also undoubtedly contributes to the rotten I/O speed. Performance is also problematic because of the historical basis of FORTRAN I/O on line printers and tapes. The output record is usually built in a buffer and output all at once. Remember, in FORTRAN you can tab backwards on the output record, for instance. Also, in trying to be all things to all people, FORTRAN has lots more output descriptors than C or any other language besides perhaps PL/I, and the syntax is a bit tricky (especially with repeats that span records, etc). This can't help much either. Not to mention the fact that FORTRAN is handcuffed into being compatible with past versions. With G formatting, why bother keeping relics like E and F around? (ANSI, that's why). More to the point, try this for a shock: READ(5,100)!where unit 5 is tty I/O 100 FORMAT(50H ) WRITE(5,100) Not only does it still compile, but it still works just like it did from FORTRAN I. Can any language historians out there explain what it was for? For a project once, I wrote some C/UNIX-like FORTRAN I/O routines on a DEC-10. Of course they were faster. (No I don't still have the code, it was MACRO-10 anyway...CVTDBO and all that!:-) M. Kenig "The statements herein are not to be taken as excuses ...abnjh!cbspt002 for bad I/O performance. No flames please!"