Skip to content

lemmy_db_views_modlog_combined has a weird performance regression #141006

Open
@lcnr

Description

@lcnr

#132064 (comment)

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-features

Build 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

Originally posted by @Nutomic in #132064

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcE-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-compiletimeIssue: Problems and improvements with respect to compile times.I-prioritizeIssue: Indicates that prioritization has been requested for this issue.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-untriagedUntriaged performance or correctness regression.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions