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,400766bdbcd86f7c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news1.google.com!proxad.net!proxad.net!194.117.148.138.MISMATCH!pe2.news.blueyonder.co.uk!blueyonder!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: This can't be done in Ada...or? Date: 17 Feb 2005 21:52:45 +0000 Organization: Pushface Sender: simon@smaug.pushface.org Message-ID: References: <1108139611.709714.36170@o13g2000cwo.googlegroups.com> <2IcPd.6268$mG6.1474@newsread1.news.pas.earthlink.net> <1108372232.436036.318690@g14g2000cwa.googlegroups.com> <1108456053.837461.20340@f14g2000cwb.googlegroups.com> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1108677237 10176 62.49.19.209 (17 Feb 2005 21:53:57 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Thu, 17 Feb 2005 21:53:57 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: g2news1.google.com comp.lang.ada:8390 Date: 2005-02-17T21:52:45+00:00 List-Id: Robert A Duff writes: > This Reflection package has a bunch of string manipulation code, > and if you instantiate it in a procedure, it will happen > every time that procedure is called (unless the compiler > is smarter than I think it is). This could indeed be very > costly. The output of with Ada.Text_IO; use Ada.Text_IO; with BC.Support.High_Resolution_Time; with PragmaRC.Reflection; procedure Refl is use type BC.Support.High_Resolution_Time.Time; Start, Finish : BC.Support.High_Resolution_Time.Time; begin Start := BC.Support.High_Resolution_Time.Clock; declare package R is new PragmaRC.Reflection; begin null; end; Finish := BC.Support.High_Resolution_Time.Clock; Put_Line ("took " & Duration'Image (Finish - Start)); end Refl; here (gnatmake -O2, gnat 5.02a1 i686-pc-linux-gnu) is smaug.pushface.org[13]$ ./refl Clock rate is 0.400914522 GHz took 0.000023852 -- Simon Wright 100% Ada, no bugs.