Introduce a fast path that avoids the `debug_tuple` abstraction when deriving De...
source link: https://github.com/rust-lang/rust/pull/88832
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
The intent here is to allow LLVM to remove the switch entirely in favor of an
indexed load from a table of constant strings, which is likely what the
programmer would write in C. Unfortunately, LLVM currently doesn't perform this
optimization due to a bug, but there is a
patch that fixes this issue. I've verified
that, with that patch applied on top of this commit, Debug for unit-like tuple
variants becomes a load, reducing the O(n) code bloat to O(1).
Note that inlining DebugTuple::finish()
wasn't enough to allow LLVM to
optimize the code properly; I had to avoid the abstraction entirely. Not using
the abstraction is likely better for compile time anyway.
Part of #88793.
r? @oli-obk
Recommend
-
37
What is the Y Combinator? In order to understand the Y combinator, one must first understand recursion. Here’s a definition. recursion (noun) see “recursion” ...
-
43
In every introductory statistics class, we learned about the normal distribution, which has Probability Density Function (PDF):...
-
20
As with myprevious post, this post is another excerpt that will be included in my final Master’s thesis, but I decided it is interesting enough to post it on its own. We start with a definition of diag...
-
16
In this series of posts, we’re going to talk about some specific monad instances, the Reader-Writer-State trio, often abbreviated to just RWS . We’re actually going to look at them a bit out of order, starti...
-
20
a, plus some other parameters on the left. * why don't we try using this as our Reader type and see what happens? * insert implementing all the instances for our Reader type here. maybe we make the whole thi...
-
8
Introduce a (SolR) Sitecore Search Abstraction
-
6
Deriving types is important for a variety of reasons, including avoiding errors and representing types and relationships clearly in code. Let’s look at an example. Deriving Types Instead of Declaring Them Anew Imagine we have...
-
5
Copy link Contributor rukai commented...
-
2
Conversation Contributor...
-
2
Contributor ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK