Path: news.daimi.aau.dk!poe From: Jacob Seligmann Newsgroups: comp.lang.beta Subject: Re: BETA questions Date: 26 Apr 1995 11:14:12 GMT Organization: DAIMI, Computer Science Dept. at Aarhus University Lines: 83 Approved: mailtonews@daimi.aau.dk Distribution: world Message-ID: <3nl9u4$c08@belfort.daimi.aau.dk> NNTP-Posting-Host: daimi.daimi.aau.dk (Mark C. Chu-Carroll) carroll@quadriga.cis.udel.edu wrote: > Don't assume that the problems that the earlier Mark posted are due to > the language. The Mjolner implementation of Beta really leaves a lot > to be desired, but *very* few (if any) of its limitations are actual > limitations of the language. Agreed. > A very big problem with Mjolner Beta is that the compiler is extremely > weak. I was one of the beta testers of Linux beta, and my impression > was that it didn't attempt to do *any* significant optimizations. (It > may have done a little bit of peephole optimizations, but I'm not > sure.) I can say for certain that it didn't do closure elimination > (beta patterns are closures. But the overwhelming majority of the > time, they don't need to be treated with the full generality of a > closure - they can be treated as simple procedures.)- the speed of > programs that did simple pattern calls was significantly slower than > it would have been had they used function calls. It didn't do any > significant common subexpression elimination. It didn't do loop > invariant code motion. It didn't do reduction in strength. > > (Note that for all of the above, my impression of what it doesn't do > is based on performance. I didn't look at generated code, because I > don't know intel assembly. What I did was try it out on various things > that are textbook examples of things that are simple to optimize. For > example, invariant code motion can be tested by putting nothing but a > piece of loop invariant code into a loop, and then measuring how > execution time changes as the loop index varies. If the compiler does > invariant code motion, then the loop becomes empty. Assuming that the > compiler does dead code elimination (a *very* simple thing - if it > does invariant code motion, it definitely does dead code elimination), > the loop will be eliminated. So the execution time shouldn't vary > with the loop index. But in Mjolner beta, it does.) The current BETA compiler does perform some closure elimination. For instance, enter- and exit-parameters are inlined, as are labeled imperatives without local variables. However, the compiler does not perform peephole optimization, it does not move loop invariant code, and it does not eliminate dead code. As far as I recall, it doesn't even assign machine registers to the most commonly used variables, but uses regular memory even in tight loops, just as it doesn't do any variable liveliness analysis. Put differently, there is *a lot* of room for future efficiency improvements! > In principle, Beta programs should perform *extremely* well: Beta is > an extremely easy language to analyze, and it lacks the features of > most OO languages that make it hard to optimize (like dynamically > bound procedure calls). So far, Mjolner Informatics has spent almost all their resources on creating a stable implementation of the full BETA language on a range of platforms, rather than optimizing the code. While I would personally love to have a more efficient implementation, I believe this has been a sound and professional approach. In the future, I certainly expect the Mjolner BETA compiler to become much more efficient. > But Mjolner Beta compiles like a mediocre > student project: almost no optimization, poor error messages, terribly > verbose, and very slow. True, the optimizations are few and far between; the error messages aren't too great (but then, they're not too bad either); the textual output is often overwhelming (although I believe version 5.1 will boast four or five levels of verbosity - finally!); and the link phase (typically not the compilation, if you watch closely) can be quite slow (a dynamic linker should solve this). But unlike a student project, the Mjolner BETA compiler handles a non-trivial (state-of-the-art, actually) object-oriented language, and it is stable: It has been used to compile very complex programs, including itself and the distributed Devise hypermedia. Also, it has been used in thousands of student projects throughout the years. /Jacob Seligmann ------------------------------------------------------------------------ Systematic Software Engineering A/S Phone: 86 15 18 66 Frichsparken Direct: 86 15 18 22 - 116 Soeren Frichs Vej 42 K Fax: 86 15 19 66 DK-8230 Aabyhoej, Denmark E-mail: jas@systematic.dk ------------------------------------------------------------------------