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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,edda2b296e2577cf X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!j25g2000yqa.googlegroups.com!not-for-mail From: =?ISO-8859-1?Q?Egil_H=F8vik?= Newsgroups: comp.lang.ada Subject: Re: GNAT's Protected Objects Date: Tue, 9 Nov 2010 02:18:27 -0800 (PST) Organization: http://groups.google.com Message-ID: <7312123d-3308-45ce-8d8c-89c0df588a81@j25g2000yqa.googlegroups.com> References: <4af1a5f4-7bf3-47ee-af67-db50e589e7a8@n32g2000pre.googlegroups.com> NNTP-Posting-Host: 193.71.180.107 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1289297907 26956 127.0.0.1 (9 Nov 2010 10:18:27 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 9 Nov 2010 10:18:27 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: j25g2000yqa.googlegroups.com; posting-host=193.71.180.107; posting-account=P68zsgoAAABKpXKMUuwuUZ_RfBk1kZfB User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:15397 Date: 2010-11-09T02:18:27-08:00 List-Id: On Nov 8, 11:32=A0pm, Jeffrey Carter wrote: > > =A0 =A0 =A0 =A0Result : Matrix; Result is shared between multiple tasks, reduce references to a minimum by using a temporary value: > > =A0 =A0 =A0 =A0task body Calc_One is > =A0 =A0 =A0 =A0 =A0 Row : Natural; > =A0 =A0 =A0 =A0 =A0 Col : Natural; Temp_Result : Float; > =A0 =A0 =A0 =A0begin -- Calc_One > =A0 =A0 =A0 =A0 =A0 All_Results : loop > =A0 =A0 =A0 =A0 =A0 =A0 =A0Control.Get (Row =3D> Row, Col =3D> Col); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0exit All_Results when Row =3D 0; > =A0 =A0 =A0 =A0 =A0 =A0 =A0Temp_Result :=3D 0.0; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0Sum : for K in Index_Value loop =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Temp_Result :=3D Temp_Result + Left (Row, = K) * Right(K, Col); > =A0 =A0 =A0 =A0 =A0 =A0 =A0end loop Sum; Result(Row, Col) :=3D Temp_Result ; > =A0 =A0 =A0 =A0 =A0 end loop All_Results; > =A0 =A0 =A0 =A0exception -- Calc_One > =A0 =A0 =A0 =A0when E : others =3D> > =A0 =A0 =A0 =A0 =A0 Ada.Text_IO.Put_Line (Item =3D> "Calc_One " & > Ada.Exceptions.Exception_Information (E) ); > =A0 =A0 =A0 =A0end Calc_One; This should give you a nice speedup :) -- ~egilhh