Thread overview
[Issue 24052] DMD frontend inliner causes major slowdown
[Issue 24052] DMD is slow to pass dlangui github pipelines
Jul 20
mhh
Jul 20
Dennis
Jul 21
Dennis
Jul 21
Dennis
July 20
https://issues.dlang.org/show_bug.cgi?id=24052

mhh <maxhaton@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxhaton@gmail.com

--- Comment #1 from mhh <maxhaton@gmail.com> ---
Only in CI?

--
July 20
https://issues.dlang.org/show_bug.cgi?id=24052

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel@live.nl

--- Comment #2 from Dennis <dkorpel@live.nl> ---
dub test is pretty quick, it takes long building example1 in release mode, which makes me suspect dmd's backend's optimizer. Possibly issue 23857

--
July 20
https://issues.dlang.org/show_bug.cgi?id=24052

--- Comment #3 from Grim Maple <grimmaple95@gmail.com> ---
(In reply to Dennis from comment #2)
> dub test is pretty quick, it takes long building example1 in release mode, which makes me suspect dmd's backend's optimizer. Possibly issue 23857

Tested on my local machine, it is `dub build -b=release` that causes a slow compile time. Not necessarily on example1, dlangui itslef takes ages to compile too.

--
July 21
https://issues.dlang.org/show_bug.cgi?id=24052

--- Comment #4 from Dennis <dkorpel@live.nl> ---
(In reply to Grim Maple from comment #3)
> Tested on my local machine, it is `dub build -b=release` that causes a slow compile time. Not necessarily on example1, dlangui itslef takes ages to compile too.

You're right. I found that the culprit is the recursive function src/dlangui/graphics/resources.d : embedResources being inlined. Adding pragma(inline, false) fixes it, so this is indeed a duplicate of issue 23857.

--
July 21
https://issues.dlang.org/show_bug.cgi?id=24052

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|DMD is slow to pass dlangui |DMD frontend inliner causes
                   |github pipelines            |major slowdown

--- Comment #5 from Dennis <dkorpel@live.nl> ---
Actually, this looks like an issue with the frontend inliner, so no duplicate. Reduction so far:

```D
struct EmbeddedResource
{
    string a;
    const ubyte[] b;
    string c;
}

EmbeddedResource[] embedResource(string resourceName)()
{
    immutable ubyte[] data = [0, 1, 2, 3, 4];
    immutable string resdir = "res";
    static if (data.length > 0)
        return [EmbeddedResource(resourceName, data, resdir)];
    else
        return [];
}

EmbeddedResource[] embedResources(string[] names)() {
    static if (names.length == 0)
        return [];
    static if (names.length == 1)
        return embedResource!(names[0])();
    else
        return embedResources!(names[0 .. $/2])() ~ embedResources!(names[$/2
.. $])();
}

enum string[] stringArray = () {
    string[350] result;
    static foreach (i; 0 .. result.length)
        result[i] = "test" ~ i.stringof;
    return result;
} ();

void main()
{
    embedResources!stringArray();
}

```

--