### Environment

Nim v2.0.0  
gc: orc  
opt: speed  
app: lib  


### Source Code

<https://github.com/panno8M/godot-nim/tree/v4.1>  
`nim c demo/src/demo.nim`  


### Occurring Problems

Compilation takes a long time.  
About 170 seconds with -f option and 120 seconds without.  
As far as the output is concerned, Nim->C is taking a long time.  


### Possible Causes

#### Excessive use of macro

10,000 functions are declared as prototypes only, and the information specified 
in pragma is used to generate processing in macro.  
<https://github.com/panno8M/godot-nim/blob/v4.1/src/godot/classes/classDetail_native.nim>
  
<https://github.com/panno8M/godot-nim/blob/v4.1/src/godot/helper/engineClassDefiner.nim>
  


#### Complex type inference

Heavy use of generics, converters, and concepts. Each of these is expanded into 
the large number of functions listed above.

#### A huge module

It is difficult to properly separate modules and organize dependencies due to 
the automatic generation of bindings, so all of the above functions are 
deployed in a single module.

### Questions

  * Which of the above problems should be addressed?
  * Are there any other possible causes besides those mentioned above?
  * Are there any universally applicable techniques to reduce compilation time?



Thanks for reading!

Reply via email to