August 28, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10866



--- Comment #9 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-08-27 17:28:27 PDT ---
(In reply to comment #8)
> Reopened because Andrej Mitrovic says the problem is not yet solved. (Close down again if I am wrong.)

I will try and produce some reliable test-cases in the coming days.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10866



--- Comment #10 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-09-12 06:35:04 PDT ---
I've pasted some fresh tests off of git-head when testing Pull 2550:

https://github.com/D-Programming-Language/dmd/pull/2550#issuecomment-24319121

In many of these tests using 2.064 git-head is twice as slow as compiling with 2.063.2. However WindowsAPI itself seems to build much faster (those recent compiler optimizations might have hit a sweet spot for this library).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10866


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|pull                        |
          Component|DMD                         |Phobos


--- Comment #11 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-09-12 13:49:29 PDT ---
As I've commented in https://github.com/D-Programming-Language/dmd/pull/2550#issuecomment-24353784, this is a Phobos issue, not a compiler one. I'm copying that comment here verbatim:

I've reduced it to a Phobos commit:

---
9a053d97c26d763718b23d14af8ef1d10d594507 is the first bad commit
commit 9a053d97c26d763718b23d14af8ef1d10d594507
Author: Dmitry Olshansky <dmitry.olsh@gmail.com>
Date:   Sat Jul 20 22:30:10 2013 +0400

    new std.uni module
---

If you check out the following commits for DMD+Druntime+Phobos:

---
DMD: 4e9a7b1
Druntime: f6692fe
Phobos: 9a053d9
---

Then compiling the following:

---
import std.stdio;
void main() { }
---

Takes ~1270 msecs. If you checkout one Phobos commit earlier (which is `1bd22b2`), it takes ~500 msecs to compile it.

Btw I can also reproduce this commit is the offending one with other libraries, like DCollections. I'm pretty sure most libraries import std.stdio at one point or another, so they will all suffer from this slowdown.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10866



--- Comment #12 from bearophile_hugs@eml.cc 2013-09-12 14:35:40 PDT ---
(In reply to comment #11)
> As I've commented in https://github.com/D-Programming-Language/dmd/pull/2550#issuecomment-24353784, this is a Phobos issue, not a compiler one. I'm copying that comment here verbatim:
> 
> I've reduced it to a Phobos commit:
> 
> ---
> 9a053d97c26d763718b23d14af8ef1d10d594507 is the first bad commit
> commit 9a053d97c26d763718b23d14af8ef1d10d594507
> Author: Dmitry Olshansky <dmitry.olsh@gmail.com>
> Date:   Sat Jul 20 22:30:10 2013 +0400
> 
>     new std.uni module

Perhaps it's only part of the std.uni module that causes such compilation slowdown. So someone should try to find such parts, and then perhaps change the Phobos code to speed up the compilation, or introduce some front-end optimizations to deal more efficiently with those parts.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10866



--- Comment #13 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-09-12 14:45:29 PDT ---
(In reply to comment #12)
> (In reply to comment #11)
> > As I've commented in https://github.com/D-Programming-Language/dmd/pull/2550#issuecomment-24353784, this is a Phobos issue, not a compiler one. I'm copying that comment here verbatim:
> > 
> > I've reduced it to a Phobos commit:
> > 
> > ---
> > 9a053d97c26d763718b23d14af8ef1d10d594507 is the first bad commit
> > commit 9a053d97c26d763718b23d14af8ef1d10d594507
> > Author: Dmitry Olshansky <dmitry.olsh@gmail.com>
> > Date:   Sat Jul 20 22:30:10 2013 +0400
> > 
> >     new std.uni module
> 
> Perhaps it's only part of the std.uni module

There was more than that module which was introduced, there is also std/internal/unicode_tables.d, which is 1.3 MB large.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10866


Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh@gmail.com


--- Comment #14 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2013-09-12 14:58:14 PDT ---
(In reply to comment #13)
> (In reply to comment #12)
> > (In reply to comment #11)
> > > As I've commented in https://github.com/D-Programming-Language/dmd/pull/2550#issuecomment-24353784, this is a Phobos issue, not a compiler one. I'm copying that comment here verbatim:
> > > 
> > > I've reduced it to a Phobos commit:
> > > 
> > > ---
> > > 9a053d97c26d763718b23d14af8ef1d10d594507 is the first bad commit
> > > commit 9a053d97c26d763718b23d14af8ef1d10d594507
> > > Author: Dmitry Olshansky <dmitry.olsh@gmail.com>
> > > Date:   Sat Jul 20 22:30:10 2013 +0400
> > > 
> > >     new std.uni module
> > 
> > Perhaps it's only part of the std.uni module
> 
> There was more than that module which was introduced, there is also std/internal/unicode_tables.d, which is 1.3 MB large.

Perfect but .. we really need these tables.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10866



--- Comment #15 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-09-12 15:03:31 PDT ---
(In reply to comment #14)
> Perfect but .. we really need these tables.

Yeah I assume we do. Maybe we can get rid of some spurious imports in std.stdio or some other module.

Or, if there's no fix maybe we'll just have to live with it.

But it's going to look real bad after Walter posted to Reddit about how the compiler is ~40% faster, and yet people's code is going to build slower on average in 2.064 due to Phobos bloating up.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10866



--- Comment #16 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2013-09-12 15:06:12 PDT ---
> > > > 9a053d97c26d763718b23d14af8ef1d10d594507 is the first bad commit
> > > > commit 9a053d97c26d763718b23d14af8ef1d10d594507
> > > > Author: Dmitry Olshansky <dmitry.olsh@gmail.com>
> > > > Date:   Sat Jul 20 22:30:10 2013 +0400
> > > > 
> > > >     new std.uni module
> > > 
> > > Perhaps it's only part of the std.uni module
> > 
> > There was more than that module which was introduced, there is also std/internal/unicode_tables.d, which is 1.3 MB large.
> 
> Perfect but .. we really need these tables.

I think that it's not the tables but rather the subtle thing is that a lot of tempalted code runs std.format and then we have this:

private void formatChar(Writer)(Writer w, in dchar c, in char quote)
{
   import std.uni : isGraphical;

    if (std.uni.isGraphical(c))
    {
        if (c == quote || c == '\\')
            put(w, '\\'), put(w, c);
        else
            put(w, c);
    }

That bounces as at CTFE to this:

bool isGraphical(dchar c)
{
    static immutable graphicalTrie = asTrie(graphicalTrieEntries);
    return graphicalTrie[c];
}

And that hurts as there is no longer ASCII only case in place and said trie look up is only fast at R-T with proper inlining.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 12, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10866



--- Comment #17 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2013-09-12 15:19:35 PDT ---
(In reply to comment #16)
> I think that it's not the tables but rather the subtle thing is that a lot of tempalted code runs std.format and then we have this:
> 
> private void formatChar(Writer)(Writer w, in dchar c, in char quote)
> {
>    import std.uni : isGraphical;
> 
>     if (std.uni.isGraphical(c))
>     {
>         if (c == quote || c == '\\')
>             put(w, '\\'), put(w, c);
>         else
>             put(w, c);
>     }
> 
> That bounces as at CTFE to this:
> 
> bool isGraphical(dchar c)
> {
>     static immutable graphicalTrie = asTrie(graphicalTrieEntries);
>     return graphicalTrie[c];
> }
> 
> And that hurts as there is no longer ASCII only case in place and said trie look up is only fast at R-T with proper inlining.

Well that's not the case with simple import std.stdio + empty main.

I think our only way out is to isolate the unicode_tables is separate compilation + ~ .di file so that compiler doesn't have to re-tokenize 1.3M file.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10866



--- Comment #18 from Walter Bright <bugzilla@digitalmars.com> 2013-10-08 02:08:09 PDT ---
(In reply to comment #17)
> I think our only way out is to isolate the unicode_tables is separate compilation + ~ .di file so that compiler doesn't have to re-tokenize 1.3M file.

Please do so!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------