diff options
author | John Hawthorn <john@hawthorn.email> | 2022-02-26 16:05:06 -0800 |
---|---|---|
committer | John Hawthorn <john@hawthorn.email> | 2022-03-03 11:23:27 -0800 |
commit | 19f331f58823dc0ff90ba7806c46380dc4064fa3 (patch) | |
tree | 230da9fe95b90dc396f20acf4c8c79850aeebf6a /sprintf.c | |
parent | 4d28009f09f0554467d914acb3c4c2dcf1cebfe7 (diff) | |
download | ruby-19f331f58823dc0ff90ba7806c46380dc4064fa3.tar.gz |
Dedup superclass array in leaf sibling classes
Previously, we would build a new `superclasses` array for each class,
even though for all immediate subclasses of a class, the array is
identical.
This avoids duplicating the arrays on leaf classes (those without
subclasses) by calculating and storing a "superclasses including self"
array on a class when it's first inherited and sharing that among all
superclasses.
An additional trick used is that the "superclass array including self"
is valid as "self"'s superclass array. It just has it's own class at the
end. We can use this to avoid an extra pointer of storage and can use
one bit of a flag to track that we've "upgraded" the array.
Diffstat (limited to 'sprintf.c')
0 files changed, 0 insertions, 0 deletions