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=0.0 required=3.0 tests=BAYES_20,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:a37:c441:: with SMTP id h1mr7003351qkm.123.1617259527119; Wed, 31 Mar 2021 23:45:27 -0700 (PDT) X-Received: by 2002:a25:7e01:: with SMTP id z1mr10248021ybc.253.1617259526801; Wed, 31 Mar 2021 23:45:26 -0700 (PDT) Path: eternal-september.org!reader02.eternal-september.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 31 Mar 2021 23:45:26 -0700 (PDT) In-Reply-To: <9233bc10-091c-46af-b613-504bcb5e1c82n@googlegroups.com> Injection-Info: google-groups.googlegroups.com; posting-host=87.88.29.208; posting-account=6yLzewoAAABoisbSsCJH1SPMc9UrfXBH NNTP-Posting-Host: 87.88.29.208 References: <07a56dcc-9e17-49b2-a980-3a5a2d265cedn@googlegroups.com> <23dcce3e-0db1-4417-a5d1-a05f03f74464n@googlegroups.com> <302c2e86-2379-46e0-b1f7-d69e7e14f9cfn@googlegroups.com> <86h7kyapsn.fsf@stephe-leake.org> <3b3ff9aa-26b9-4da7-82de-a5f6c1980335n@googlegroups.com> <8f009bf0-d5a3-42b8-9bd9-12bce24f1093n@googlegroups.com> <9233bc10-091c-46af-b613-504bcb5e1c82n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Performance of records with variant parts From: Emmanuel Briot Injection-Date: Thu, 01 Apr 2021 06:45:27 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:61716 List-Id: > Studying the code, I realized that there was no reason that Intersections_Type had to keep a copy of thing(which); it could instead just remember which, and the caller could obtain thing(which) directly. Well done, seems like it wasn't so easy to find, even if the fix is simple in the end. I think the -gnatD code you show is because GNAT is creating a temporary object then copying it in the output. So there's one extra copy. The like "A81b.think := things (which)" might be pretty costly too, depending on the size of thing.