• @asdfasdfasdf@lemmy.world
    link
    fedilink
    7
    edit-2
    21 hours ago

    Five minutes with build cache? Or from cold build?

    With cache, then there’s almost certainly something wrong with your computer or project.

    Also… you aren’t building with --release every time are you?

          • @MangoCats@feddit.it
            link
            fedilink
            English
            415 hours ago

            100k loc without a reasonable architecture is… problematic.

            I have run into problems with C++ linker/optimizers which will choke on big (50k loc) .cpp files which are auto-generated from definitions, they get slow like that, build times around 20 minutes for the worst of them. Keep the files more like 10k loc and down if you don’t want this kind of issue.

            • ☆ Yσɠƚԋσʂ ☆
              link
              fedilink
              2
              edit-2
              15 hours ago

              Nowhere did I say there’s no reasonable architecture. Please don’t put words in my mouth. What I said, is that I haven’t found a good way to get quick compiles end to end. And already I don’t have any files more than 3-4k loc, most are under 1k.

          • @asdfasdfasdf@lemmy.world
            link
            fedilink
            317 hours ago

            Yeah I doubt it. I’ve worked in large Rust codebases too. I’d do some benchmarking. Cargo has some nice flags that let you see exactly what it’s doing. You can open the compilation report up in a browser and zoom in on different steps of the process and see everything.

            • ☆ Yσɠƚԋσʂ ☆
              link
              fedilink
              217 hours ago

              I’ve tried looking before and couldn’t get a significant improvement. I’ll have to investigate it again I guess.

              • @ISO@lemmy.zip
                link
                fedilink
                416 hours ago

                Make sure you’re using a fast linker. Although I think lld is the default now, so that should be less of a concern these days. But see if mold or wild would help.

                More relevantly, you should be using cranelift for codegen in dev builds.

                If you have codegen-units = 1 in your release profile, make sure you have a separate dev profile that doesn’t.

                If you still experience decapitating slowness (doubtful), and it’s actually the rust compiler being slow (super doubtful), you can try the parallel frontend. Apparently there are almost™ no bugs left in its implementation (It’s one of the project priorities now).

                Needless to say, but you should be checking your --timings to really know what’s going on.