Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!willett!ForthNet From: ForthNet@willett.UUCP (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: Optimization Message-ID: <547.UUL1.3#5129@willett.UUCP> Date: 24 Feb 90 21:54:50 GMT Organization: Latest link in the ForthNet chain. (Pgh, PA) Lines: 65 Date: 02-24-90 (01:48) Number: 1755 (Echo) To: PETE KOZIAR Refer#: 1729 From: MIKE SPERL Read: NO Subj: OPTIMIZATION Status: PUBLIC MESSAGE Pete, >why not just write in assembly language altogether? >A High-level language should be poortable at least to SOME extent, >and writing the whole shebang in assembly-language with a small >FORTH mainline makes it about as portable as an organ transplant. In the inline code example I referred to, the assembler does the same as the hi level, i.e., the hi level calls an assembler word that does the same thing, except the hi level does a lot of stack thrashing that is unnecessary, and uses next - VERY iinefficient! Fortth is a lot handier than assembler alone, and, in NEXT, more efficient as well. But doing everything in hi levell would make forth less efficient than almost any other language, and so far as transportability, moving words even between different versions of F83 or F-PC is a chore. Do commercial forths guarantee transportability between versions of tthe same brand? How easy is itt to move code between brands? This seems like a poor reason to avoid assembler words, which, I suspect, are more poortablle between versions running on the same cpu than the hi level forth is! >I appreciate that graphics is a unique application because of speed, >but even you'll have to worry about portability. What happenns if the >graphics co-processors like the IBM 8514 or the TI chip become the >norm, and all the main processor has to do is send them graphics >primitives? Or, even worse, if you want to convert your code to run on >the graphics coprocessors? Writing it in assembly--language will cook >your oown goose. We've been thru that alreadyy. The cga code is quite different than the ega/vga code, and if another system takes over, that will neeed specific code tooo. But the algorithms will be similar, and we've tried to comment the code so they're understandable. Hi level code won't be anyy more transportable, because it's based oon low level code somewhere in the prrogram that will require rewriting. When you port any language to a new cpu, somebody has to do a lot of programmming, maybe not you. :--) We are reallly writing a graphics kkernel analogous tto thhe forth kernel. >By the other way, a GIF viewer "word" in FORTH would be a great thing >for writing adventure games and/or displaying pictures as error >indicators. It would be neat to be able, for instance, to guide a >technician throughh servicing a piece of equipment by displaying >pictures showing what's wroong. The posssibilities are endless. Good ideas, all of them. I certainly hope someone will use our code to make a useful hi level program. >Keep up the good work. Thanks. - Mike - ----- This message came from GEnie via willett through a semi-automated process. Report problems to: 'uunet!willett!dwp' or 'willett!dwp@gateway.sei.cmu.edu'