From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9bc0262607f781e9 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-07 08:00:44 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: dennison@telepath.com (Ted Dennison) Newsgroups: comp.lang.ada Subject: Re: Making a package safe for use by multiple tasks Date: 7 Jun 2002 08:00:43 -0700 Organization: http://groups.google.com/ Message-ID: <4519e058.0206070700.78d59613@posting.google.com> References: NNTP-Posting-Host: 65.115.221.98 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1023462044 18869 127.0.0.1 (7 Jun 2002 15:00:44 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 7 Jun 2002 15:00:44 GMT Xref: archiver1.google.com comp.lang.ada:25455 Date: 2002-06-07T15:00:44+00:00 List-Id: "Alexander Boucke" wrote in message news:... > I am just playing with the idea to use multiple tasks in a programm doing > linear algebra. The problem lies in my vector-algebra package, that uses > some global tmp-object to optimize memory use and reuse. To give you the ... > since I do reference counting on the vectors. The thing with the tmp_vec > enables me to reuse this vector several times, e.g. in d := a + b + c it is > not necessary to allocate it new every time, I could just overwrite tmp_vec > here. Forgive me for a bit of ignorance, but how exactly is this quicker than making tmp_vec a local variable inside of "+" (which would be perfectly task safe)? Also, how are you saving enough speed with either method to make up for the vector copy that happens at the return statement? Also, complicated operations like your "a + b + c" construction may even have to allocate memory from the heap to store the intermediate results. If you are truly that worried about speed, shouldn't you be using procedures with "in out" parameters instead of functions? -- T.E.D. Home - mailto:dennison@telepath.com (Yahoo: Ted_Dennison) Homepage - http://www.telepath.com/dennison/Ted/TED.html