RejectedSoftware Forums

Sign up

Very slow compilation with dub

I have to build and test a project with this dependencies

...
"dependencies": {
      "gtk-d:gtkd": "~master",
      "dunit": ">=1.0.9",
      "dejector": "~master"
}

These are the results on my (old and slow) PC:

|           | 1st | 2nd   | test |
| --------- |-----| ----- | ---- |
|dub        | 38s | 14s   | 45s  |
|dub --rdmd |  8s |  6s   | -    |
|make       |  3s |  0s   | 9s   |

1st indicates first build time (ie 'time dub build'), 2nd indicates second build without changing anything, and finally test indicates test time (ie 'time dub test')

As you can see test takes 45s ... so I'm therefore obliged to use make.

Is there a way to improve dub performance?

Re: Very slow compilation with dub

Am 16.04.2014 23:16, schrieb Orfeo:

I have to build and test a project with this dependencies

...
"dependencies": {
       "gtk-d:gtkd": "~master",
       "dunit": ">=1.0.9",
       "dejector": "~master"
}

These are the results on my (old and slow) PC:

|           | 1st | 2nd   | test |
| --------- |-----| ----- | ---- |
|dub        | 38s | 14s   | 45s  |
|dub --rdmd |  8s |  6s   | -    |
|make       |  3s |  0s   | 9s   |

1st indicates first build time (ie 'time dub build'), 2nd indicates second build without changing anything, and finally test indicates test time (ie 'time dub test')

As you can see test takes 45s ... so I'm therefore obliged to use make.

Is there a way to improve dub performance?

Which version of DUB are you using? There have been some changes that
may affect performance recently.

It would be interesting to see where exactly the time is spent during
the build. Can you try to roughly estimate from the console output how
much time is spent for the actual compilation, how much for
initialization and how much for linking?

If compilation takes considerably longer than for --rdmd, that would
indicate that only a very small part of the code is actually used and
RDMD skips most files when passing them to DMD. But more importantly,
using --rdmd compiles the whole project at once instead of building
separate static libraries for the dependencies. You could also try to
use --combined and see how it compares, it should especially improve the
first run.

But 14 s for the second run indicates that there is considerable time
spend either during initialization, or while checking for changes. I
think I'll implement a little time summary for dub -v so that a better
analysis is possible.

Re: Very slow compilation with dub

Thank you Ludwig for your reply, so:

On Thu, 17 Apr 2014 08:33:03 +0200, Sönke Ludwig wrote:

--------->8--------
Which version of DUB are you using?
--------->8--------

In previous post DUB version 0.9.22-Beta2+11-gd54b5c5
In this post DUB version 0.9.22-beta.2+14-g1189389
DMD64 D Compiler v2.065

--------->8--------
It would be interesting to see where exactly the time is spent during
the build. Can you try to roughly estimate from the console output how
much time is spent for the actual compilation, how much for
initialization and how much for linking?
--------->8--------

About 20% init, 5% compiling, 75% linking

--------->8--------
If compilation takes considerably longer than for --rdmd, that would
indicate that only a very small part of the code is actually used and
RDMD skips most files when passing them to DMD. But more importantly,
using --rdmd compiles the whole project at once instead of building
separate static libraries for the dependencies. You could also try to
use --combined and see how it compares, it should especially improve the
first run.
--------->8--------

New test with --combined and DUB version 0.9.22-beta.2+14:

|           | 1st  | 2nd   | test |
| --------- |------| ----- | ---- |
|dub        | 27s  | 11s   | 36s  |
|dub --rdmd |  8s  |  6s   | -    |
|dub --comb |  56s |  11s  | 1'16s|
|make       |  3s  |  0s   | 3.7s |