Skip to content

Use sccache to improve build time #35

@dhovart

Description

@dhovart
Contributor

sccache can be used to cache built dependencies and improve solutions build time.

I may work on this this week.

Activity

dhovart

dhovart commented on Dec 2, 2021

@dhovart
ContributorAuthor

@ErikSchierboom I don't know much of your infrastructure.
Is it possible to use if it exists a docker volume for storage that would store:

1/ the compilation cache from sccache
2/ and additionally the rust local registry introduced in #27, that would contain older versions of a crate (instead of regenerating it each time with the crates newest versions as we do each time we build the test runner) ?

ErikSchierboom

ErikSchierboom commented on Dec 2, 2021

@ErikSchierboom
Member

@dhovart Currently we do not support external volumes. We might in the future.

ErikSchierboom

ErikSchierboom commented on Dec 9, 2021

@ErikSchierboom
Member

@dhovart Couldn't you build an exercise at Docker build time (as in: in the Dockerfile) that uses all dependencies? I imagine that the compilation cache is then populated and that, when running the image, it will re-use that.

senekor

senekor commented on Jul 18, 2023

@senekor
Contributor

This may as a side effect allow people to use compile-time heavy crates, e.g. anything syn-based. Currently, using such dependencies makes the tests time out due to long build time.

ErikSchierboom

ErikSchierboom commented on Jul 18, 2023

@ErikSchierboom
Member

This may as a side effect allow people to use compile-time heavy crates, e.g. anything syn-based. Currently, using such dependencies makes the tests time out due to long build time.

Can we precompile those?

senekor

senekor commented on Jul 18, 2023

@senekor
Contributor

I thought that was the point of using sccache, caching the compilation of dependencies. I haven't used it before myself though, so I might be misunderstanding something.

ErikSchierboom

ErikSchierboom commented on Jul 20, 2023

@ErikSchierboom
Member

I thought that was the point of using sccache, caching the compilation of dependencies. I haven't used it before myself though, so I might be misunderstanding something.

Oh I don't know much about Rust. What does sccache do exactly?

senekor

senekor commented on Jul 20, 2023

@senekor
Contributor

It caches build artifacts in a more sophisticated manner than the standard toolchain does. C and C++ are supported too.

Currently, every exercise that's submitted is compiled from scratch, including its dependencies. This is both time consuming (costly) and actually prevents some dependencies from being used at all, because they increase build time so much the timeout is triggered.

The proposed solution is to use sccache to precompile the dependencies, embed that cache in the docker image and compile submitted solutions through sccache as well.

I think this would be very beneficial and hope to find time to pick up the stale PR at some point.

(I wonder how much space that cache might take, since we're also talking about reducing the image size atm.)

dhovart

dhovart commented on Jul 20, 2023

@dhovart
ContributorAuthor

Hi, sorry for the PR going stale. Let me know if you'd want me to take this over again.

senekor

senekor commented on Jul 20, 2023

@senekor
Contributor

@dhovart that sounds great! Reading the description of that PR, it kinda depends on this one: #40

I believe the last state of that PR was to try to use dependabot to automatically update version-pinned dependencies. Would you be interested in tackling that?

ErikSchierboom

ErikSchierboom commented on Jul 20, 2023

@ErikSchierboom
Member

The proposed solution is to use sccache to precompile the dependencies, embed that cache in the docker image and compile submitted solutions through sccache as well.

That sounds awesome.

dhovart

dhovart commented on Jul 21, 2023

@dhovart
ContributorAuthor

@dhovart that sounds great! Reading the description of that PR, it kinda depends on this one: #40

I believe the last state of that PR was to try to use dependabot to automatically update version-pinned dependencies. Would you be interested in tackling that?

Thanks for your work on this. I actually won't have time to continue working on this one until next week, so feel free to do it if you want to start today!

linked a pull request that will close this issue on Jul 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @ErikSchierboom@dhovart@senekor

      Issue actions

        Use sccache to improve build time · Issue #35 · exercism/rust-test-runner