November 29, 2022

On Tuesday, 29 November 2022 at 02:16:14 UTC, zjh wrote:

>

On Monday, 28 November 2022 at 21:45:37 UTC, TheGag96 wrote:

>

Maybe it's time to revisit Stefan's type functions? Or, even though it won't exactly help the template slowness, work on getting newCTFE finished up?

'D' should also absorpt some people into the core team and allow them to play freely. Take advantage of the fact that they already know D very well.

November 28, 2022

On 11/28/22 9:12 PM, zjh wrote:

>

On Tuesday, 29 November 2022 at 01:58:48 UTC, Steven Schveighoffer wrote:

>

such things (type functions would be nice to have).

>

D's core strength is compile-time metaprogramming and code generation. -Steve

 If there is no metaprogramming for D, why not use C++?
The author leaves D, which is also the compile time performance of D, currently cannot meet the needs of heavy metaprogramming.

  1. C++ metaprogramming is... not the same.

  2. I think if you are looking for better compile times, C++ is not the right path.

-Steve

November 29, 2022
On 29/11/2022 3:22 PM, zjh wrote:
> `'D'` should also absorpt some people into the `core team` and allow them to `play freely`. Take advantage of the fact that they already know D very well.

You don't need to be in the core team to contribute, or to experiment.

November 29, 2022

On Tuesday, 29 November 2022 at 02:37:25 UTC, Steven Schveighoffer wrote:

>

...

Looking forward to your article.

November 28, 2022
On 11/27/2022 1:29 AM, FeepingCreature wrote:
> Like `is(T : U*, U)` instead of `isPointer`.

std.traits.isPointer is defined as:

    enum bool isPointer(T) = is(T == U*, U) && __traits(isScalar, T);

though I have no idea why the isScalar is there. When is a pointer ever not a scalar?
November 28, 2022
On 11/27/2022 1:29 AM, FeepingCreature wrote:
> 3. But also if we're talking about number of instantiations, `hasUDA` and `getUDA` lead the pack. I think the way these work is just bad - I've rewritten all my own `hasUDA`/`getUDA` code to be of the form `udaIndex!(U, __traits(getAttributes, T))` - instantiating a unique copy for every combination of field and UDA is borderline quadratic - but that didn't help much even though `-vtemplates` hinted that it should. `-vtemplates` needs compiler time attributed to template recursively.

hasUDA and getUDAs are defined:


enum hasUDA(alias symbol, alias attribute) = getUDAs!(symbol, attribute).length != 0;

template getUDAs(alias symbol, alias attribute)
{
    import std.meta : Filter;

    alias getUDAs = Filter!(isDesiredUDA!attribute, __traits(getAttributes, symbol));
}


These do look pretty inefficient. Who wants to fix Phobos with FeepingCreature's solution?
November 29, 2022
On Monday, 28 November 2022 at 17:08:04 UTC, H. S. Teoh wrote:
> On Mon, Nov 28, 2022 at 04:27:03AM +0000, Basile B. via Digitalmars-d wrote: [...]
>> For better compile times and with LDC people should also always use the undocumented option `--disable-verify` (for a DUB recipe this would go in the dlags-ldc2 array for example).
>> 
>> By default ldc2 verifies the IR produced [...]
>
> Hmm.  I just tested `--disable-verify` on one of my medium-complexity projects (just under 40 .d files, compiled in a single command); didn't measure any significant speed difference.  Both with and without `--disable-verify` it took about 20 seconds for a full build (generate Linux & Windows executables + run unittests).
>
>
> T

Maybe your code is too good to make IR verification falling into pathological cases.
November 28, 2022
On 11/28/2022 2:39 PM, Per Nordlöw wrote:
> On Monday, 28 November 2022 at 22:27:34 UTC, Walter Bright wrote:
>> Phobos2 needs to take a hard look at all the template forwarding going on.
>>
>> I've also noticed that many templates can be replaced with 2 or 3 ordinary function overloads.
> 
> Finally, we are starting realize the cost of these issues in terms of lost productivity during incremental development.

I've complained about the conversion thing for 10 years now :-)
November 28, 2022
We have made several attempts at making templates faster, such as the alias reassignment change. Some big improvements happened.

Some benchmarking shows that a couple templates were at the top of the list of time lost instantiating them. I hardwired them into the compiler, and now those go pretty fast.

A lot can be done by simply going through Phobos and examining the templates that forward to other templates, and perhaps manually inlining templates to avoid expansions.
November 29, 2022

On Tuesday, 29 November 2022 at 02:37:25 UTC, Steven Schveighoffer wrote:

>

On 11/28/22 9:12 PM, zjh wrote:

>

On Tuesday, 29 November 2022 at 01:58:48 UTC, Steven Schveighoffer wrote:

>

such things (type functions would be nice to have).

>

D's core strength is compile-time metaprogramming and code generation. -Steve

 If there is no metaprogramming for D, why not use C++?
The author leaves D, which is also the compile time performance of D, currently cannot meet the needs of heavy metaprogramming.

  1. C++ metaprogramming is... not the same.

  2. I think if you are looking for better compile times, C++ is not the right path.

-Steve

Using C++20 modules in Visual C++, I can assert that that reason to fame for C++ will eventually be sorted out.

All my hobby coding with C++ now makes use of C++ modules.

And yes, this is yet something that C++ has taken inspiration from D.