rust-lang / rust-lang/rust

`lemmy_db_views_modlog_combined` has a weird performance regression

Open
#141,006 17 comments 0 reactions 1 assignee View on GitHub

@steffahn is already working on this.

Since Jul 5, 2026.

C-bug E-needs-mcve I-compiletime P-high regression-untriaged T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

https://github.com/rust-lang/rust/issues/132064#issuecomment-2862157673

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.