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:05:23 +0200 Organization: University of Aarhus, Department of Computer Science (DAIMI) Lines: 49 Message-ID: <372FEDB3.5955E7BC@cs.au.dk> References: <19990504130450.11074.qmail@noatun.mjolner.dk> 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 925887923 2203609 255.255.255.255 (5 May 1999 07:05:23 GMT) X-Complaints-To: news@cs.au.dk NNTP-Posting-Date: 5 May 1999 07:05:23 GMT X-Mailer: Mozilla 4.07C-SGI [en] (X11; I; IRIX 6.5 IP32) Xref: news.cs.au.dk comp.lang.beta:11922 Morten Grouleff wrote: > Daniel Bonniot writes: > > > > > 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. > > > > OK but this could be done by explicitly initializing local attributes. > > Yes, but that could easily end up taking more time, as the > initialization done by the allocation is very efficient. > > > Isn't there a harder problem for concurent threads ? If two threads > > called the single object, the two executions would share local > > attributes, which could lead to errors. > > True. Another potential problem is that it keeps the object alive > longer than it probably needs, leading to increased memory usage. Another thing again is that when using static objects is initialization: p:(# s:@(# ... #) (* huge object with lots of static objects *) ... #) When allocating a P, the program also creates a s, and all of s' statics objects. This does not only take memory, but also executiontime as the objects origins has to be computed at allocation time. In a situation where s is eventually not used i P (P can have lots of functions) this is waste. /gram > > -- > ** Morten Grouleff: ** > ** Earthworm Jim PC: ** > ** Mjølner Informatics: **