Speeding up compile times on GLFW

Monkey Forums/Monkey Programming/Speeding up compile times on GLFW

Shinkiro1(Posted 2015) [#1]
Hi,

the glfw target for me is really slow to compile.

Compiling the bouncy aliens example I wait around 7 seconds on the first compile, 5 on every subsequent one.

My computer is a MacBook Air 2012 model (with an SSD).
Even though I can compile an sdl example of similar complexity in < 1 second.

So is my processor the bottleneck, RAM (4GB) or is the monkey compile process just ineffiecent. If so what can one do about it?

PS: Yes I know these things will be handled better in MX2, this is strictly about monkey 1 though.


Nobuyuki(Posted 2015) [#2]
1. Use msbuild instead of gcc (Not sure if it's available on OSX yet)
2. #FAST_SYNC_PROJECT_DATA=True (don't do this if you're using xcode)


Shinkiro1(Posted 2015) [#3]
Well I am on OSX so msbuild is out.
#FAST_SYNC_PROJECT_DATA doesn't really help, I tried that.

It would be interesting to know which parts in the compilation step take the longest, then optimize them.


dawlane(Posted 2015) [#4]
First the Monkey compiler is a translating compiler. It converts monkey code into a form that a native compiler can use to compile the final application. It creates one main file for compiling, and if this is big, it can take sometime. This file will get rebuilt every time you run the monkey compiler. The GCC/LLVM tool chain, which will be used for compiling this "main" file have always been a bit on the slow side. MS compilers are somewhat faster. There are GCC/LLVM options to use multi core processors to build multiple files at the same time, but this would become useless after the first build, as only the "main" file will get compiled in subsequent builds.

So this is the general process when you first build a monkey project.
The build directory is created and your program data gets copied.
The monkey code gets converted to code that the native compiler can handle. It pulls in template code, library code and files from the target and modules directories, which all end up in the build directory. Your code, the template code and whatever module code end up in the "main" file.
Depending on the target; for a desktop application, either a makefile or project file is invoked to start the build process. It will build the GLFW/support object files and the main file and link them. Subsequent builds will only build and link the "main" file, unless you make alterations to any GLFW/support files or "clean" the project. If you want to customize the build, then the makefile or project file is the place to do it.

If you want it any faster you will either have to make major alterations to the monkey compiler and how it works, or just wait for MX2 which is meant to solve this issue with incremental building.