Path: news.cs.au.dk!Morten.Grouleff.Mjolner.Informatics From: Morten Grouleff Newsgroups: comp.lang.beta Subject: Re: Speeding up BETA Date: 04 May 1999 09:34:26 +0200 Organization: Mjolner Informatics. Lines: 50 Message-ID: References: <7glmo2$6di$1@nnrp1.dejanews.com> NNTP-Posting-Host: freki.mjolner.dk Mime-Version: 1.0 (generated by tm-edit 7.106) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: xinwen.cs.au.dk 925803266 2154432 255.255.255.255 (4 May 1999 07:34:26 GMT) X-Complaints-To: news@cs.au.dk NNTP-Posting-Date: 4 May 1999 07:34:26 GMT X-Newsreader: Gnus v5.5/Emacs 19.34 Xref: news.cs.au.dk comp.lang.beta:11917 Andrew Klaassen writes: > On my machine, this program: > > ... > ---program:descriptor--- > (# > > myputtext: @puttext; > > do > (for 1 000 000 repeat ''->myputtext; for) > #) > > runs at about twice the speed of this program: > > ... > ---program:descriptor--- > (# > > do > (for 1 000 000 repeat ''->puttext; for) > #) > > I tried a few other built-in BETA patterns; the same was > true for all of them. (Some of them - the ones that don't > have to print to the screen - ran at about ten times the > speed.) Actually, they're not built-in in the language or the compiler, they are implemented in BETA in betaenv.bet and its BODY-fragments. The difference in times for patterns printing to the screen compared to others is probably due to the calls to the OS. > 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. Regards, -- ** Morten Grouleff: ** ** Earthworm Jim PC: ** ** Mjølner Informatics: **