Skip to content

Conversation

@jgallagher
Copy link
Contributor

This is a purely mechanical movement of the majority of DataStore's methods into separate module files in an attempt to speed up compilation (particularly incremental compilation). On my machine, it looks like a modest success, cutting incremental compilation down by ~7 seconds for both test and non-test builds:

Operation main (2a2a7f7e) this branch (647e336e)
clean build, lib+bin 2m 55s 2m 48s
incremental build, lib+bin, datastore.rs modified 45s 38s
clean build, tests 5m 5s 4m 49s
incremental build, tests, datastore.rs modified 1m 14s 1m 8s

where "lib+bin" is cargo build -p omicron-nexus and "tests" is cargo build -p omicron-nexus --tests (i.e., the build of the tests without running them). Modifying files underneath datastore/ on this branch results in identical timings to modifying datastore/mod.rs (which is surprising to me, but it's quite reliable).

These timings are all debug builds; if there's interest I can collect them for release builds also.

@jgallagher jgallagher requested a review from smklein July 15, 2022 20:27
@david-crespo
Copy link
Contributor

Pretty cool, didn't know this would have this effect. 10% on incremental builds is pretty good!

@jgallagher
Copy link
Contributor Author

@smklein suggested it when we were chatting about ideas as a way to speed up incremental times since diesel is one of the biggest time sinks. I don't understand why this would speed up the clean builds, though!

Copy link
Collaborator

@smklein smklein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my own tests:

Before this patch, incremental rebuild (touch datastore.rs && cargo build): In the range of 19-21 seconds

After this patch, incremental rebuild (touch datastore/mod.rs && cargo build): In the range of 19-21 seconds

I'm not seeing much of a difference here - I'm on a 16 core, 32 GiB machine.

That being said, I still like this PR regardless of the performance implications, so LGTM, but it's curious that I'm not replicating your results.

use std::sync::Arc;
use uuid::Uuid;

#[tokio::test]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll probably make sense to move some of these out too, but we can punt on that for now

@jgallagher jgallagher merged commit 8ec2cb7 into main Jul 16, 2022
@jgallagher jgallagher deleted the break-datastore-into-modules branch July 16, 2022 13:48
@jgallagher
Copy link
Contributor Author

Out of curiosity, what happens if you modify datastore.rs (e.g., add a word to the doc comment at the top of the file) instead of just touch'ing it?

leftwo pushed a commit that referenced this pull request Sep 18, 2024
Crucible changes:
    Make crutest use BlockIO trait instead of a Guest (#1452)
    Use new syncfs syscall (#1427)
    Increment write backpressure before deferred encryption (#1444)
    Use RAII handles for backpressure (#1443)
    Fine-tuning backpressure clamping, and API cleanups (#1442)
    Fix outdated comment (#1447)
    Update Rust crate rusqlite to 0.32 (#1418)
    Fix write reordering bug (#1448)
    Remove `history_file` (#1446)
    Remove optionality for `BlockRes` in `DeferredWrite` (#1441)

Propolis changes
    instance spec rework: tighten up component naming (#761)
    instance spec rework: remove most dependencies on `InstanceSpecV0` from propolis-server (#757)
    fix new 1.81.0 warning and clippy error (#760)
    standalone: be more helpful with bad block device configs (#758)
leftwo added a commit that referenced this pull request Sep 18, 2024
Crucible changes:
    Make crutest use BlockIO trait instead of a Guest (#1452)
    Use new syncfs syscall (#1427)
    Increment write backpressure before deferred encryption (#1444)
    Use RAII handles for backpressure (#1443)
    Fine-tuning backpressure clamping, and API cleanups (#1442)
    Fix outdated comment (#1447)
    Update Rust crate rusqlite to 0.32 (#1418)
    Fix write reordering bug (#1448)
    Remove `history_file` (#1446)
    Remove optionality for `BlockRes` in `DeferredWrite` (#1441)

Propolis changes
    instance spec rework: tighten up component naming (#761)
instance spec rework: remove most dependencies on `InstanceSpecV0` from
propolis-server (#757)
    fix new 1.81.0 warning and clippy error (#760)
    standalone: be more helpful with bad block device configs (#758)

Co-authored-by: Alan Hanson <alan@oxide.computer>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants