From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Performance of records with variant parts
Date: Mon, 22 Mar 2021 21:30:56 +0100 [thread overview]
Message-ID: <s3aupr$1jpb$1@gioia.aioe.org> (raw)
In-Reply-To: 3fb9acf6-cf8b-4199-aca8-28d6ff60d63dn@googlegroups.com
On 2021-03-22 19:23, John Perry wrote:
> I think I understand that, but the check for "obj.kind" is there in both versions of the code. Isn't that a dynamic check even when I use a non-variant record? What's the difference in the check when I'm checking the discriminant of a variant record and the value of a field?
1. Depending on the optimization level the compiler might keep the
second check in place when accessing the variant field regardless the
selected case statement alternative.
2. A varying size object might be allocated on the secondary stack
rather than on the program stack. That could indict a sufficient penalty
3. Variant alternatives could be allocated outside the object. That
would require an additional indirection and thus penalties when copying
objects and accessing fields.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2021-03-22 20:30 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 [this message]
2021-03-22 18:59 ` Niklas Holsti
2021-03-22 21:54 ` John Perry
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox