comp.lang.ada
 help / color / mirror / Atom feed
From: John Perry <john.perry@usm.edu>
Subject: Re: Performance of records with variant parts
Date: Mon, 22 Mar 2021 14:54:13 -0700 (PDT)	[thread overview]
Message-ID: <b8037068-5da7-4c2a-ac74-7cc7790e11a3n@googlegroups.com> (raw)
In-Reply-To: <ibs7okF5i52U1@mid.individual.net>

On Monday, March 22, 2021 at 1:59:34 PM UTC-5, Niklas Holsti wrote:
> What is your optimization level? -O2? 

I've tried several. The one with the best performance is -O3 -funroll-loops -gnatn.

> Moreover, in your case the compiler should 
> statically know the offset of each discriminant-dependent component, so 
> accessing such a component should not require any overhead compared to a 
> record without discriminants. 

Precisely this perplexes me. Nothing in this section of the code would be unknown after the discriminant check. -- Nothing that seems obvious to me, anyway. I'll copy some code in a reply to someone else in a moment.

> However, in the past I've seen unexpectedly slow code for copying 
> records with discriminants. ...
> [very interesting material excised for brevity]
> If the compiler is stupidly checking the discriminant of obj for each 
> obj-component access, you may be able to speed up the code by creating 
> separate sub-procedures

I liked this idea and thought it might be the problem, but that also didn't help out. I may have to look at the assembly, which I am loath to do. :-/

john perry

      reply	other threads:[~2021-03-22 21:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 17:02 Performance of records with variant parts John Perry
2021-03-22 17:32 ` Jeffrey R. Carter
2021-03-22 17:49   ` John Perry
2021-03-22 17:54     ` John Perry
2021-03-22 19:31     ` Jeffrey R. Carter
2021-03-22 22:11       ` John Perry
2021-03-23  9:31         ` Jeffrey R. Carter
2021-03-23 14:27           ` Simon Wright
2021-03-23 23:00           ` John Perry
2021-03-23 23:27             ` Jeffrey R. Carter
2021-03-26 15:38               ` Stephen Leake
2021-03-26 15:44                 ` John Perry
2021-03-30  7:12                   ` Emmanuel Briot
2021-04-01  0:03                     ` John Perry
2021-04-01  6:45                       ` Emmanuel Briot
2021-04-01 13:38                       ` Niklas Holsti
2021-04-02 16:07                         ` John Perry
2021-03-22 17:39 ` Dmitry A. Kazakov
2021-03-22 17:45   ` John Perry
2021-03-22 18:07     ` Dmitry A. Kazakov
2021-03-22 18:23       ` John Perry
2021-03-22 20:30         ` Dmitry A. Kazakov
2021-03-22 18:59 ` Niklas Holsti
2021-03-22 21:54   ` John Perry [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox