www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to make a slow compile

reply monkyyy <crazymonkyyy gmail.com> writes:
once again dconf contains people who talk about compile speed as 
if it can be slow

What are they doing? Even my worse compile time abstraction was 
O(n^2) or maybe some awful string concatenation of an entire 
file; still effectively instant

Wheres a 1000 line file that does something meta programmingly 
useful that takes 5 minutes?

Do they lose track of what the compiler is even doing? Do they 
turn off the template recursion depth limit?
Aug 20
next sibling parent Kapendev <alexandroskapretsos gmail.com> writes:
On Wednesday, 20 August 2025 at 15:33:45 UTC, monkyyy wrote:
 once again dconf contains people who talk about compile speed 
 as if it can be slow

 What are they doing? Even my worse compile time abstraction was 
 O(n^2) or maybe some awful string concatenation of an entire 
 file; still effectively instant

 Wheres a 1000 line file that does something meta programmingly 
 useful that takes 5 minutes?

 Do they lose track of what the compiler is even doing? Do they 
 turn off the template recursion depth limit?
No idea. Maybe they should use shell + awk + sed more. This is how chads generate code **blazingly** fast.
Aug 20
prev sibling next sibling parent reply Brother Bill <brotherbill mail.com> writes:
On Wednesday, 20 August 2025 at 15:33:45 UTC, monkyyy wrote:
 once again dconf contains people who talk about compile speed 
 as if it can be slow
Compiling Hello world in D is a little bit slower that Go language.
Aug 20
next sibling parent monkyyy <crazymonkyyy gmail.com> writes:
On Wednesday, 20 August 2025 at 16:57:18 UTC, Brother Bill wrote:
 On Wednesday, 20 August 2025 at 15:33:45 UTC, monkyyy wrote:
 once again dconf contains people who talk about compile speed 
 as if it can be slow
Compiling Hello world in D is a little bit slower that Go language.
Thats the runtime and std self importing everything and if your being wrong dub taking an entire 1/2 second to consider how to to call one of the easiest to work with compilers Th dub thing is straight stupid, the std should have a dag of acceptable imports, and the runtime is unfortunate fixed cost. But even if dub is in play with its unacceptable half sec to read a 10 line json, it isnt the "90 minutes" weka compile they talk about.
Aug 20
prev sibling parent Kapendev <alexandroskapretsos gmail.com> writes:
On Wednesday, 20 August 2025 at 16:57:18 UTC, Brother Bill wrote:
 On Wednesday, 20 August 2025 at 15:33:45 UTC, monkyyy wrote:
 once again dconf contains people who talk about compile speed 
 as if it can be slow
Compiling Hello world in D is a little bit slower that Go language.
C with tcc is faster than D an GO.
Aug 20
prev sibling next sibling parent reply evilrat <evilrat666 gmail.com> writes:
On Wednesday, 20 August 2025 at 15:33:45 UTC, monkyyy wrote:
 once again dconf contains people who talk about compile speed 
 as if it can be slow

 What are they doing? Even my worse compile time abstraction was 
 O(n^2) or maybe some awful string concatenation of an entire 
 file; still effectively instant

 Wheres a 1000 line file that does something meta programmingly 
 useful that takes 5 minutes?

 Do they lose track of what the compiler is even doing? Do they 
 turn off the template recursion depth limit?
I have godot-dlang builds (with dub/LDC) compiling for about 3 minutes on top hardware. But this is more of a config issues and how LDC handles all that code symbols(functions, etc...), having to build a spaghetti templates for over 1k classes is no joke. This is something i am planning to look into, having a tiny WASM game scripts for 30 Mb shared library is no fun. This is mainly because it uses dub import-paths AND source-paths together for usability simplicity reasons. Would be much faster to remove source-paths and properly configure D's -i include pattern, that requires figuring dub configuration that properly uses predefined env variables.
Aug 20
parent reply Monkyyy <crazymonkyyy gmail.com> writes:
On Thursday, 21 August 2025 at 05:38:08 UTC, evilrat wrote:
 On Wednesday, 20 August 2025 at 15:33:45 UTC, monkyyy wrote:
 once again dconf contains people who talk about compile speed 
 as if it can be slow

 What are they doing? Even my worse compile time abstraction 
 was O(n^2) or maybe some awful string concatenation of an 
 entire file; still effectively instant

 Wheres a 1000 line file that does something meta programmingly 
 useful that takes 5 minutes?

 Do they lose track of what the compiler is even doing? Do they 
 turn off the template recursion depth limit?
I have godot-dlang builds (with dub/LDC) compiling for about 3 minutes on top hardware. But this is more of a config issues and how LDC handles all that code symbols(functions, etc...), having to build a spaghetti templates for over 1k classes is no joke. This is something i am planning to look into, having a tiny WASM game scripts for 30 Mb shared library is no fun. This is mainly because it uses dub import-paths AND source-paths together for usability simplicity reasons. Would be much faster to remove source-paths and properly configure D's -i include pattern, that requires figuring dub configuration that properly uses predefined env variables.
 spaghetti template
Can you post what you believe is slow? Can dub cause 3 minute compiles, I would've thought it would O() based on file count (reading json badily into concat a unnesserily complex compile commmand) is dub some how worse then I thought possible?
Aug 21
next sibling parent evilrat <evilrat666 gmail.com> writes:
On Thursday, 21 August 2025 at 13:52:32 UTC, Monkyyy wrote:
 On Thursday, 21 August 2025 at 05:38:08 UTC, evilrat wrote:
 On Wednesday, 20 August 2025 at 15:33:45 UTC, monkyyy wrote:
 once again dconf contains people who talk about compile speed 
 as if it can be slow

 What are they doing? Even my worse compile time abstraction 
 was O(n^2) or maybe some awful string concatenation of an 
 entire file; still effectively instant

 Wheres a 1000 line file that does something meta 
 programmingly useful that takes 5 minutes?

 Do they lose track of what the compiler is even doing? Do 
 they turn off the template recursion depth limit?
I have godot-dlang builds (with dub/LDC) compiling for about 3 minutes on top hardware. But this is more of a config issues and how LDC handles all that code symbols(functions, etc...), having to build a spaghetti templates for over 1k classes is no joke. This is something i am planning to look into, having a tiny WASM game scripts for 30 Mb shared library is no fun. This is mainly because it uses dub import-paths AND source-paths together for usability simplicity reasons. Would be much faster to remove source-paths and properly configure D's -i include pattern, that requires figuring dub configuration that properly uses predefined env variables.
 spaghetti template
Can you post what you believe is slow? Can dub cause 3 minute compiles, I would've thought it would O() based on file count (reading json badily into concat a unnesserily complex compile commmand) is dub some how worse then I thought possible?
Like i've said it is from the fact that the project tries to build over 1k classes, an entire godot API. It does templated binding calls, parameter conversions, class registration, etc... This is also related to LDC's way of managing symbol visibility for shared libraries, it simply does not knows what needed, except maybe the simplest cases, can be partially solved with doing `dub --build-mode=allAtOnce`. DMD on the other hand does all this in just seconds. here is a cold full rebuild using DMD on windows `godot-dlang> measure-command { dub build :test }` `TotalSeconds : 13,9210259` and a build after minor change `TotalSeconds : 1,7115313`
Aug 21
prev sibling parent evilrat <evilrat666 gmail.com> writes:
On Thursday, 21 August 2025 at 13:52:32 UTC, Monkyyy wrote:
 On Thursday, 21 August 2025 at 05:38:08 UTC, evilrat wrote:
 On Wednesday, 20 August 2025 at 15:33:45 UTC, monkyyy wrote:
 once again dconf contains people who talk about compile speed 
 as if it can be slow

 What are they doing? Even my worse compile time abstraction 
 was O(n^2) or maybe some awful string concatenation of an 
 entire file; still effectively instant

 Wheres a 1000 line file that does something meta 
 programmingly useful that takes 5 minutes?

 Do they lose track of what the compiler is even doing? Do 
 they turn off the template recursion depth limit?
I have godot-dlang builds (with dub/LDC) compiling for about 3 minutes on top hardware. But this is more of a config issues and how LDC handles all that code symbols(functions, etc...), having to build a spaghetti templates for over 1k classes is no joke. This is something i am planning to look into, having a tiny WASM game scripts for 30 Mb shared library is no fun. This is mainly because it uses dub import-paths AND source-paths together for usability simplicity reasons. Would be much faster to remove source-paths and properly configure D's -i include pattern, that requires figuring dub configuration that properly uses predefined env variables.
 spaghetti template
Can you post what you believe is slow?
https://github.com/Circular-Studios/Dash here is a good example, this project does heavily rely on reflection, similar to godot-dlang but going even further to also do serialization and other things, all that resulted in long builds. though it'll probably no longer compiles without major rewrite, i remember it was like 40 seconds builds after every source change. https://github.com/Circular-Studios/Dash
Aug 21
prev sibling parent reply Andrey Zherikov <andrey.zherikov gmail.com> writes:
On Wednesday, 20 August 2025 at 15:33:45 UTC, monkyyy wrote:
 once again dconf contains people who talk about compile speed 
 as if it can be slow

 What are they doing? Even my worse compile time abstraction was 
 O(n^2) or maybe some awful string concatenation of an entire 
 file; still effectively instant

 Wheres a 1000 line file that does something meta programmingly 
 useful that takes 5 minutes?

 Do they lose track of what the compiler is even doing? Do they 
 turn off the template recursion depth limit?
My recent experience: removing usage of SumType and replacing it with my own solution reduced dmd memory usage from 6GB to 1.7GB and improved compilation speed.
Aug 24
parent monkyyy <crazymonkyyy gmail.com> writes:
On Sunday, 24 August 2025 at 13:59:46 UTC, Andrey Zherikov wrote:
 On Wednesday, 20 August 2025 at 15:33:45 UTC, monkyyy wrote:
 once again dconf contains people who talk about compile speed 
 as if it can be slow

 What are they doing? Even my worse compile time abstraction 
 was O(n^2) or maybe some awful string concatenation of an 
 entire file; still effectively instant

 Wheres a 1000 line file that does something meta programmingly 
 useful that takes 5 minutes?

 Do they lose track of what the compiler is even doing? Do they 
 turn off the template recursion depth limit?
My recent experience: removing usage of SumType and replacing it with my own solution reduced dmd memory usage from 6GB to 1.7GB and improved compilation speed.
What sort of difference did you do? Did the memory usage matter for speed at all?
Aug 24