From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Performance of records with variant parts Date: Mon, 22 Mar 2021 20:31:43 +0100 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <07a56dcc-9e17-49b2-a980-3a5a2d265cedn@googlegroups.com> <23dcce3e-0db1-4417-a5d1-a05f03f74464n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 22 Mar 2021 19:31:44 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="3f41081ced237a412fd5237c283cfd93"; logging-data="3791"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Be4xqOE5ROFG5kL6DKXdUTg6tnLznJ7g=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 Cancel-Lock: sha1:wR33vs3Jn8XGAC9btNCenaY6ST8= In-Reply-To: <23dcce3e-0db1-4417-a5d1-a05f03f74464n@googlegroups.com> Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:61640 List-Id: On 3/22/21 6:49 PM, John Perry wrote: > > This is a raytracing program. There are no particular timing requirements, but if I wanted a larger image with more objects things would get ugly. This is really more a matter of my curiosity. If you have no timing requirements, then you don't care how long it takes and have no issue. > > Obj is an "in" parameter to a function. Do you need more than that? Yes. What compiler and optimization option are you using? I would expect any compiler (except GNAT at -O0) to optimize away any discriminant checks on direct accesses to variant components in the branches of the case statement. Is Obj passed to any subprograms from the branches of the case statement? Are any variant components accessed outside of the case statement? -- Jeff Carter "One day he told me he was a gynecologist. He couldn't speak no foreign languages." Take the Money and Run 147