Jakt compiler is quite slow to compile. This slows down development of the language. Most of the time is spent in the Clang.
Currently on my machine:
$ time ./build/jakt selfhost/main.jakt > build/baseline.cpp
real 0m4.788s
$ time clang++ -std=c++20 -I runtime/ -Wno-parentheses-equality -Wno-trigraphs -Wno-user-defined-literals build/baseline.cpp
real 0m14.547s
I have profiled this a little and saw some directions how compilation can be sped up:
Token
. It is a Variant
with ~100 alternatives, and is very slow to compile. Another one visible in the profile is CheckedExpression
. While other variants in the code are not that prominent in the profile individually, they probably take quite some time cumulatively. This suggests that Variant
is a good candidate for optimization.debug_description
functions.
debug_decription
fucntionsdebug_description
still uses Variant::visit
which is particularly slow to compile. Usage of visit
has already been removed from other parts of generated code (matches), so it can be removed from here too. PR: #1038 by @Hendiadyoin1 --- -1s build time (-8%)debug_description
functions can be sped up by minimizing printing calls by merging them together.-fno-exceptions
#1043 -2.7s (-23%)-fno-rtti
, -fno-unwind-tables
did not make any measurable differenceI have not investigated that yet
Profiling was done with clang with command line:
time clang++ -std=c++20 -I runtime/ -Wno-parentheses-equality -Wno-trigraphs -Wno-user-defined-literals -ftime-trace -c -o build/baseline.o build/baseline.cpp
This generates baseline.json
in the build
directory.
Profile is attached:
baseline.zip
you can inspect it using Speedscope, Perfetto, Chrome dev tools, etc.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too