www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - [vibe] what's wrong with linking time of vibe applications?

reply Dmitry Ponyatov <dponyatov gmail.com> writes:
D lang noted as having a very fast compilation time.

Playing with tiny web-interface apps I found that modern versions 
of dmd & vibe has such a fast compiling but a very long 
executable linking time.

Something like 2-3 seconds of compiling stage (with vibe 
prebuilt), and 24 seconds of total build time

```
dponyatov i7:~/wad$ time dub build
```
```
      Pre-gen Running commands for openssl
     Starting Performing "debug" build using /usr/bin/dmd for 
x86_64.
   Up-to-date fswatch 0.6.1: target for configuration [library] is 
up to date.
   Up-to-date mir-linux-kernel 1.0.1: target for configuration 
[library] is up to date.
   Up-to-date taggedalgebraic 0.11.22: target for configuration 
[library] is up to date.
   Up-to-date eventcore 0.9.27: target for configuration [epoll] 
is up to date.
   Up-to-date stdx-allocator 2.77.5: target for configuration 
[library] is up to date.
   Up-to-date vibe-container 1.0.1: target for configuration 
[library] is up to date.
   Up-to-date vibe-core 2.6.0: target for configuration [epoll] is 
up to date.
   Up-to-date vibe-d:crypto 0.9.7: target for configuration 
[library] is up to date.
   Up-to-date vibe-d:utils 0.9.7: target for configuration 
[library] is up to date.
   Up-to-date vibe-d:data 0.9.7: target for configuration 
[library] is up to date.
   Up-to-date diet-ng 1.8.1: target for configuration [library] is 
up to date.
   Up-to-date vibe-d:stream 0.9.7: target for configuration 
[library] is up to date.
   Up-to-date vibe-d:textfilter 0.9.7: target for configuration 
[library] is up to date.
   Up-to-date vibe-d:inet 0.9.7: target for configuration 
[library] is up to date.
   Up-to-date vibe-d:tls 0.9.7: target for configuration [openssl] 
is up to date.
   Up-to-date vibe-d:http 0.9.7: target for configuration 
[library] is up to date.
   Up-to-date vibe-d:mail 0.9.7: target for configuration 
[library] is up to date.
   Up-to-date vibe-d:mongodb 0.9.7: target for configuration 
[library] is up to date.
   Up-to-date vibe-d:redis 0.9.7: target for configuration 
[library] is up to date.
   Up-to-date vibe-d:web 0.9.7: target for configuration [library] 
is up to date.
   Up-to-date vibe-d 0.9.7: target for configuration [library] is 
up to date.
     Building wad ~shadow: building configuration [application]
Compiling Diet HTML template index.dt...
Compiling Diet HTML template about.dt...
Compiling Diet HTML template error.dt...
      Linking wad
     Finished To force a rebuild of up-to-date targets, run again 
with --force
```
```
real    0m24.748s
user    0m19.133s
sys     0m2.565s
```
Dec 22 2023
parent evilrat <evilrat666 gmail.com> writes:
On Friday, 22 December 2023 at 19:12:14 UTC, Dmitry Ponyatov 
wrote:
 D lang noted as having a very fast compilation time.

 Playing with tiny web-interface apps I found that modern 
 versions of dmd & vibe has such a fast compiling but a very 
 long executable linking time.

 Something like 2-3 seconds of compiling stage (with vibe 
 prebuilt), and 24 seconds of total build time
Welcome to template bloat hell. IIRC diet templates is very template heavy, it makes tons of (D) template instantiations and the linker has a lot of work because of that. It is even worse with LDC. If there is runtime diet parser(which I doubt) instead of default `render!` template you can move diet to it to save on compile time.
Dec 24 2023