Replies: 10 comments 9 replies
-
I tried using the mold linker which is known to improve compile times in some cases, but it didn't seem to help here. |
Beta Was this translation helpful? Give feedback.
-
I think it's reasonable to split |
Beta Was this translation helpful? Give feedback.
-
Out of curiosity I ran scryer-prolog through codescene.io which is a static analysis tool that analyzes code for things like technical debt and code health, primarily based on version control history (which is somewhat unique among analyzers ime). As with any analyzer tool take its 'advice' with mountains of salt, but I found it amusing to poke around at the visualizations at least: https://codescene.io/projects/45799/jobs/1744446/results/code/hotspots/system-map https://codescene.io/projects/45799/jobs/1744446/results/code/hotspots/system-map#codehealth |
Beta Was this translation helpful? Give feedback.
-
How much would such a change accelerate the build? Probably not by much. Going stepwise back to identify the moment when an error has been introduced will still be forbiddingly costly. (Things somewhat improve by setting Maybe instead, consider to build the executable with a unique suffix, like the one by |
Beta Was this translation helpful? Give feedback.
-
One idea to circumvent the low memory availability of the Github Runners is to use swapfiles to "increase RAM". Github Runners have 14GB of disk space (minus the space used by the system, Rust, and the build process itself) that we could potentially use in a swapfile. I found this action that proves this is possible to do, but it's not too hard to do it manually in the CI .yml file. Reducing memory usage of the build would be much better of course, as this would not only benefit the runners but also contributors on lower end hardware. I have only 8GB of RAM for example. I have a humongous swap file (well, now it's 8GB, but I've made it over 30GB on one occasion) exactly for situations like this. Swap being orders of magnitude slower than RAM means that the builds are also very slow when they have to use it. |
Beta Was this translation helpful? Give feedback.
-
I asked on the matrix rust channel and someone suggested running
I'm not sure what to do with it, but here's the output (click to expand):
|
Beta Was this translation helpful? Give feedback.
-
One tip I've seen some times is to pass the |
Beta Was this translation helpful? Give feedback.
-
I think a boundary that maybe is worth separating into a different crate is the Prolog libraries that are inlined into the executable. I don't think it would make much of a difference in memory usage though. |
Beta Was this translation helpful? Give feedback.
-
This thread contains some ideas for inspecting compile time memory usage: How to debug rustc memory usage spikes In particular, there are:
If I try any of these I'll post the results. |
Beta Was this translation helpful? Give feedback.
-
I tried to move some functions from |
Beta Was this translation helpful? Give feedback.
-
scryer-prolog is currently 60k+ lines of rust, and alone takes 4+ minutes to compile on my machine. You can check compile times on your machine by running
cargo build --release --timings
which generates a nice.html
file with a flow chart and details about building each crate.Here are the timings from building on my machine with the above command after a
cargo clean
, first a full compile (5m6s) and then touchingbuild/static_string_indexing.rs
and doing an "incremental" build (4m9s): cargo-timings.zipIn addition, the peak memory usage while compiling the scryer-prolog crate is ~6GB, which I guess is 5x+ the memory usage of the next crate based on the chart I posted the other day. This may be the cause of some recent builds failing apparently due to out of memory errors.
I don't know if breaking the project up into more crates will help with memory usage. But breaking into multiple crates is the "standard line" when having trouble with compile times in rust projects, maybe it will help with memory usage too? 🤷
I'm not really familiar with the scryer-prolog rust codebase so I regret to admit that I'm not posting with a specific plan in mind, just a couple questions:
Beta Was this translation helpful? Give feedback.
All reactions