Path: news.cs.au.dk!not-for-mail From: Flemming Gram Christensen Newsgroups: comp.lang.beta Subject: Re: Speeding up BETA Date: Wed, 05 May 1999 09:16:00 +0200 Organization: University of Aarhus, Department of Computer Science (DAIMI) Lines: 87 Message-ID: <372FF030.3C8DFE35@cs.au.dk> References: <7glmo2$6di$1@nnrp1.dejanews.com> <7gnuou$4qg$1@nnrp1.dejanews.com> NNTP-Posting-Host: akagi.cs.au.dk Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: xinwen.cs.au.dk 925888560 2210930 255.255.255.255 (5 May 1999 07:16:00 GMT) X-Complaints-To: news@cs.au.dk NNTP-Posting-Date: 5 May 1999 07:16:00 GMT X-Mailer: Mozilla 4.07C-SGI [en] (X11; I; IRIX 6.5 IP32) Xref: news.cs.au.dk comp.lang.beta:11923 Andrew Klaassen wrote: > In article , > Morten Grouleff wrote: > > Andrew Klaassen writes: > ---snip--- > > > > > > I tried a few other built-in BETA patterns; > ---snip--- > > > > Actually, they're not built-in in the language or the compiler, they are > > implemented in BETA in betaenv.bet and its BODY-fragments. > > > > ...mmm...yes. "Forgive us our trespasses against precise > terminology... " > > ---snip--- > > > > > Are there good reasons _not_ to use a single object > > > instantiated from a built-in pattern, like the above, in > > > "real" programs? > > > > For patterns like putline, no. But the pattern must be able to handle > > it: Some patterns depend on the fact that their local attributes are > > initialized (to zero, empty string, false depending on the type). This > > is done at allocation, so calling it twice might make such patterns > > behave badly. > > Of course. If I would have thought about this a wee smidge > before firing off my question, I would have remembered that > bit about local attributes being initialized to zero/false/ > etc. > > Looking through another comp.lang.beta thread ("Inconsistency > in the Mjoelner implemenation?"), I noticed that this > characteristic of BETA (or just of Mjolner BETA?) also makes > it difficult for the compiler to attempt the same kind of > optimization as I'm asking about here. > > Is this question of "automatically initializing local > variables makes it more difficult for a compiler to decide > whether 'inserted objects' could be used to optimize code" > one that's debated when languages are designed? Is it just > an OO problem? A BETA problem? > > (Sorry if the question violates the boundaries of this > newsgroup...or if the most appropriate response to it would > be, "There are schools that teach this sort of thing, you > know..." ) Automatical initialization of local variables is not the only thing to be considered when optimizing code. When executing a functions dopart the function can give a reference to itself (this(Object)[] or similary) to other functions which then can access the functions local variables. This means that program behavior can change dramastically when changing from a fresh (newly instantiated) object to a static. It is naturally incomputable to decide if the compiler can change a inserted object to static object, and it takes at least a whole-program analysis (fixed-point computation) to compute a usable aproximation. This is not done in the current compiler, but a couple of projects has addressed this problem. The major minus is execution time. Beta has execellent facilities for code-reuse, this means that even little programs normally uses a lot of different libraries, which again means that the whole-program analysis has to analyse a lot of code, and is not a obvius choice of optimization-technique. /gram > > > > > > Regards, > > -- > > ** Morten Grouleff: ** > > ** Earthworm Jim PC: ** > > ** Mjølner Informatics: ** > > > > Thanks! > Andrew Klaassen > > -----------== Posted via Deja News, The Discussion Network ==---------- > http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own