RWMIRA01@ULKYVX.BITNET (Rob Miracle) (03/25/88)
In Reply to Mark Granoffs (mhg@mitre.bedford.ARPA): >>... >>2) The BASIC INKEY function is horridly slow (as is the rest of VAX-11 BASIC. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > >I feel compelled to take offense at this statement. I do not think >that VAX BASIC can be lumped in and judged together with other BASIC >compilers for other machines. No other BASIC compilers are being judged here. Just VAX BASIC. >The fact that the INKEY function you refer to is "horridly slow" is >not the fault of the VAX or the VAX BASIC compiler, but of the source >code. If you write bad/slow source code, you get bad/slow/(worse) >machine code. First of all ---- I write most of my code on VMS in BASIC!!! Why, because it is the easiest language to access system services in. But it is still not as fast other languages for several reasons: 1) BASIC is not as efficent with RMS as other languages. I wrote a program that read a 6000 record, 600 bytes per record file that selected about 2000 records based on a 1 condition selection in both VAX COBOL and VAX BASIC. It took 35 seconds in BASIC on an 11/780. The same program in COBOL with the same load on the same machine (I was the only one on) took 8 seconds. 2) The INKEY function reads the keystrokes and parses them. I suspect that it calls SMG because of the way that it does the parsing. SMG or INKEY is not the fastest way to get a character from the terminal. 3) Not all compilers generate the same machine code. Yes it is all VMS binary, but, the way that the MACRO is spit out is different. BASIC is not the best optimized language on VMS. It is also probably not the worst either. 4) Back to the INKEY function. I wrote a utility for DCL that functions like the INQUIRE command except that it allows single key input to the command procedure. That is the syntax: KEYIN var prompt The BASIC version was a simple LIB$GET_FOREIGN to get the var and prompt PRINT the prompt, INKEY the key assign the key to VAR and exit. The C version did a similar thing except that it used a function similar to the one that I posted. Since both programs printed the prompt, we have to assume that they both started the INKEY operation at the same time. The only statment after the INKEY is a call to the same LIB routine. The C version executes much faster than the BASIC version. Again, I was not flaming BASIC in general since I use it and SMG quite often, but rather pointing out that the INKEY operation was slower and VAX basic as a rule is slower. > >It suffices to say that I am suitably pissed off at your arrogance. >Before you make a broad, sweeping statement like "VAX-11 BASIC is >horridly slow," check your facts. > >*FLAME OFF* You are entitled to your opinion. I am not being arrogant -- although I have a right to be. I have checked my facts. By the By, My opininons are my own. Any one else who wants them can write for permission to use them. +-------------------------+---------------------------------------------------+ |Rob Miracle | Bitnet : RWMIRA01@ULKYVX or RWMIRA01@ULKYVM | |Programmer/Analyst-II | CompuServe: 74216,3134 | |University of Louisville | GEnie Mail: MIRACLERW | +-------------------------+ UUCP : ...psuvax1!ulkyvx.bitnet!rwmira01 | |"I'm so good, I dont need| INTERNET : rwmira01%ulkyvx.bitnet@cunyvm.cuny.edu| |an ego." -- Anton Devious| : | +-------------------------+---------------------------------------------------+