The subject has been brought up a few times in the past and I’m curious what is everybody’s experiences.
My application takes a little under 4 minutes (without --release) and about an hour (with --release), with 260.490 LOC (poor metric, but what else is there) under WSL and an i7-8700.
WSL has very slow file access. WSL2 is much faster. I recommend to get Windows Insider versions of Windows with WSL2,
I have 6 years old MacBookPro (Mid 2014) and I upgraded it to faster 1TB SSD.
It takes about a minute to compile Crystal compiler in debug mode.
4 minutes? yikes. Hopefully sometime they can speed that up or parallelize it or something. In the meantime I hope you have some workaround where you can split out the code into smaller compile segments during dev???
Here’s mine:
crystal source git dir: make
touch src/slice.cr
$ time make
Late 2009 macbook
real 3m38.6s
ubuntu laptop i7-3540M CPU @ 3.00GHz
real 0m57.9s
vultr 4GB 2core “high frequency compute” instance
Intel Core Processor (Skylake, IBRS) 3.8GHz
real 0m32.9s
WSL i5-2500 3.3GHz
real 1m45s
For WSL sometimes disabling antivirus/windows defender can make a difference…
It takes me literally 30s to compile the compiler on linux. Does using OSX and windows slow things down so much?
$ time make
Using /usr/bin/llvm-config [version=9.0.1]
g++ -c -o src/llvm/ext/llvm_ext.o src/llvm/ext/llvm_ext.cc -I/usr/include -std=c++11 -fno-exceptions -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
cc -fPIC -c -o src/ext/sigfault.o src/ext/sigfault.c
ar -rcs src/ext/libcrystal.a src/ext/sigfault.o
CRYSTAL_CONFIG_PATH="/data/programming/crystal-lang/crystal/feature/shebang/src" CRYSTAL_CONFIG_LIBRARY_PATH="" CRYSTAL_CONFIG_BUILD_COMMIT="5a8b6de94" ./bin/crystal build -o .build/crystal src/compiler/crystal.cr -D without_openssl -D without_zlib
make 49.66s user 5.77s system 180% cpu 30.675 total
I’d really like to hear of benchmarks (with --stats) on the same hardware between OSes, since I’ve always been impressed with crystal’s compile performance.
On a similar note - does anyone have any large projects other than the crystal spec suite? compiling all_spec.cr takes about two minutes for me.
# Crystal 0.33.0 Release
$ time crystal build --release src/start_server.cr
crystal build --release src/start_server.cr 178.62s user 4.10s system 99% cpu 3:03.66 total
# Crystal 0.33.0
$ time crystal build src/start_server.cr
crystal build src/start_server.cr 30.36s user 4.44s system 237% cpu 14.630 total
# Crystal 0.34.0 Release
$ time crystal build --release src/start_server.cr
A total of 1 warnings were found.
crystal build --release src/start_server.cr 186.04s user 4.09s system 99% cpu 3:11.35 total
# Crystal 0.34.0
$ time crystal build --release src/start_server.cr
A total of 1 warnings were found.
crystal build src/start_server.cr 78.71s user 5.61s system 131% cpu 1:04.34 total
➜ crystal git:(0.34.0) ✗ time make
Using /usr/local/opt/llvm/bin/llvm-config [version=9.0.1]
c++ -c -o src/llvm/ext/llvm_ext.o src/llvm/ext/llvm_ext.cc -I/usr/local/Cellar/llvm/9.0.1/include -std=c++11 -stdlib=libc++ -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
cc -fPIC -c -o src/ext/sigfault.o src/ext/sigfault.c
ar -rcs src/ext/libcrystal.a src/ext/sigfault.o
CRYSTAL_CONFIG_PATH="/Users/lribeiro/Work/crystal/src" CRYSTAL_CONFIG_LIBRARY_PATH="/usr/local/Cellar/crystal/0.33.0/embedded/lib" CRYSTAL_CONFIG_BUILD_COMMIT="4401e90f0" ./bin/crystal build -o .build/crystal src/compiler/crystal.cr -D without_openssl -D without_zlib
make 59.37s user 4.78s system 185% cpu 34.540 total
Mine was just cd in to the directory, and run that command. So no warmup, just went in cold. But I prefer to see numbers at their worst. If I can live with it at that speed, then anything faster if a bonus.
Thankfully I never have to see those compile times on releases. I run deploy, and then come back a few min later and it’s all done.