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-Thread: 103376,4cf1fd41f64f8f02 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Sun, 04 Jun 2006 12:22:27 -0500 From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: task-safe hash table? References: X-Newsreader: Tom's custom newsreader Message-ID: Date: Sun, 04 Jun 2006 12:22:27 -0500 NNTP-Posting-Host: 67.169.16.3 X-Trace: sv3-3gfr3n+eviG9lnkRjoslMbfS9nJ1J1U2dj8brPwoBznj/Yo0a4ysfMLbNq6lGYMLMXr601RZfaqHfYg!rp4bJuVWPkkpHKhBoqoeWCeK4KKzbzYiNWETAQfUqwH5phUSxJCV/EQt/ShKvc1Xf35pNF+vYAgB!LRUHY6CNmYSk X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:4674 Date: 2006-06-04T12:22:27-05:00 List-Id: with ada.calendar, ada.text_io; procedure timeprot is protected type p_type is entry a(x: in integer); procedure b(x : in integer); function c(x : in integer) return integer; private p_dummy : integer := 0; end p_type; protected body p_type is entry a(x: in integer) when p_dummy = 0 is begin p_dummy := x;end a; procedure b(x : in integer) is begin p_dummy := x;end b; function c(x : in integer) return integer is begin return p_dummy+x;end c; end p_type; dummy : integer := 0; procedure a(x : in integer) is begin dummy := x;end a; procedure b(x : in integer) is begin dummy := x;end b; function c(x : in integer) return integer is begin return dummy+x;end c; procedure measure is use type ada.calendar.time; t0,t1 : ada.calendar.time; junk : integer; begin t0 := ada.calendar.clock; for i in 1 .. 1_000 loop a(i/3_000); -- ensure that parameter to call = 0 end loop; t1 := ada.calendar.clock; ada.text_io.put_line("a" & duration'image((t1-t0)*1000) & " mics"); t0 := ada.calendar.clock; for i in 1 .. 1_000 loop b(i/3_000); end loop; t1 := ada.calendar.clock; ada.text_io.put_line("b" & duration'image((t1-t0)*1000) & " mics"); t0 := ada.calendar.clock; for i in 1 .. 1_000 loop junk:=c(i/3_000); end loop; t1 := ada.calendar.clock; ada.text_io.put_line("c" & duration'image((t1-t0)*1000) & " mics"); end measure; prot : p_type; procedure measure_p is use type ada.calendar.time; t0,t1 : ada.calendar.time; junk : integer; begin t0 := ada.calendar.clock; for i in 1 .. 1_000 loop prot.a(i/3_000); end loop; t1 := ada.calendar.clock; ada.text_io.put_line("prot.a" & duration'image((t1-t0)*1000) & " mics"); t0 := ada.calendar.clock; for i in 1 .. 1_000 loop prot.b(i/3_000); end loop; t1 := ada.calendar.clock; ada.text_io.put_line("prot.b" & duration'image((t1-t0)*1000) & " mics"); t0 := ada.calendar.clock; for i in 1 .. 1_000 loop junk:=prot.c(i/3_000); end loop; t1 := ada.calendar.clock; ada.text_io.put_line("prot.c" & duration'image((t1-t0)*1000) & " mics"); end measure_p; begin measure; measure_p; measure; measure_p; end timeprot;