Description
We recently split up our code into multiple crates for better parallel compilation. This also helped to narrow down where exactly the slowdown discussed here is happening, namely in this file. I already removed most irrelevant code, and it seems clear that the slowdown is somehow related to diesel. You can reproduce with the following commands:
git clone https://github.com/LemmyNet/lemmy.git --recursive --branch modlog-combined-remove-derives
cd lemmy
cargo build --timings -p lemmy_db_views_modlog_combined --all-featuresBuild timings only for lemmy_db_views_modlog_combined crate: 1.81.0: 23s 1.86.0: 188s 1.88.0-nightly (7918c7eb5 2025-04-27): 188s
I hope this will help to fix the problem, because we are stuck on 1.81 until it is resolved.
cc @weiznich: Are you aware of problems with slow compilation of diesel code starting from Rust 1.82?
In case its helpful here is profiling data for
lemmy_db_views_modlog_combined
using cargo 1.88.0-nightly (7918c7eb5 2025-04-27):
Item Self time % of total time Time Item count Incremental result hashingtime check_liveness 82.00s 42.409 82.04s 43 4.60µs mir_built 76.86s 39.752 169.03s 43 562.14µs layout_of 16.74s 8.656 84.04s 5691 1.26ms