New blog post on the cost of compile time
Steven Schveighoffer
schveiguy at gmail.com
Mon Jan 16 15:13:04 UTC 2023
On 1/16/23 3:10 AM, Arjan wrote:
> On Monday, 16 January 2023 at 04:30:25 UTC, Steven Schveighoffer wrote:
>> https://www.schveiguy.com/blog/2023/01/the-cost-of-compile-time-in-d/
>>
>> Let me know what you think.
>
> I think it is marveleous. Wondering are there any down sides to using
> typeof?
In this instance, no. This was just a case of "oh, look, there's
ReturnType, so I can just use that" instead of trying to actively avoid
using the tools in std.traits.
But in general, we still want to be able to use the cool tools that
Phobos gives us without too much penalty, so the larger problem still
remains -- templates just should be better performing.
In general, Phobos templates should try to avoid using simple wrappers
for internal things. One thing I didn't discuss in the post is that the
`ReturnType` instances here are only ever going to be instantiated
*once*, and on something that is *never used* (the lambda function).
Once the boolean for `isInputRange` is decided, there is no reason to
keep that stuff around. Some way to cull those templates from the cache
would be most welcome.
-Steve
More information about the Digitalmars-d
mailing list