www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18731] New: Link only druntime for the runnable tests if

https://issues.dlang.org/show_bug.cgi?id=18731

          Issue ID: 18731
           Summary: Link only druntime for the runnable tests if Phobos
                    isn't needed
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: bootcamp
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: greensunny12 gmail.com

All 1283 fail_compilation tests compile in ~11s on my machine.
The 774 compilable tests are slightly slower with ~25s ... and you don't want
to know how long runnable takes :/
So the runnable tests are the real bad boys.
(numbers are taken with an i7 4th Gen with full parallelism)

Now a majority of the tests doesn't even need Phobos, so a simple optimization
could be to only link druntime if nothing from Phobos is imported.
At the moment DRuntime has a size of 9.8M whereas Phobos clocks in with 64M
(including druntime).
So just using DRuntime would mean a lot less work for the linker.

At the moment this the linking is defined in `test/Makefile` like
`DFLAGS+=-defaultlib=libphobos2.so`, now in theory it would be as easy as
replacing this with `DFLAGS+=-defaultlib=libdruntime.so.a`, in practice more
work is required because it needs to be done only for the tests that don't use
Phobos (or all tests using Phobos need to be moved to Phobos)

--
Apr 04 2018