←back to thread

302 points Bogdanp | 2 comments | | HN request time: 0.001s | source
Show context
taylorallred ◴[] No.44390996[source]
So there's this guy you may have heard of called Ryan Fleury who makes the RAD debugger for Epic. The whole thing is made with 278k lines of C and is built as a unity build (all the code is included into one file that is compiled as a single translation unit). On a decent windows machine it takes 1.5 seconds to do a clean compile. This seems like a clear case-study that compilation can be incredibly fast and makes me wonder why other languages like Rust and Swift can't just do something similar to achieve similar speeds.
replies(18): >>44391046 #>>44391066 #>>44391100 #>>44391170 #>>44391214 #>>44391359 #>>44391671 #>>44391740 #>>44393057 #>>44393294 #>>44393629 #>>44394710 #>>44395044 #>>44395135 #>>44395226 #>>44395485 #>>44396044 #>>44401496 #
ben-schaaf ◴[] No.44393294[source]
Every claim I've seen about unity builds being fast just never rings true to me. I just downloaded the rad debugger and ran the build script on a 7950x (about as fast as you can get). A debug build took 5s, a release build 34s with either gcc or clang.

Maybe it's a MSVC thing - it does seem to have some multi-threading stuff. In any case raddbg non-clean builds take longer than any of my rust projects.

replies(3): >>44394691 #>>44400609 #>>44405178 #
maccard ◴[] No.44394691[source]
I use unity builds day in day out. The speed up is an order of magnitude on a 2m+ LOC project.

If you want to see the difference download unreal engine and compile the editor with and without unity builds enabled.

My experience has been the polar opposite of yours - similar size rust projects are an order of magnitude slower than C++ ones. Could you share an example of a project to compare with?

replies(2): >>44397204 #>>44397303 #
almostgotcaught ◴[] No.44397204[source]
How many LOC is unreal? I'm trying to estimate whether making LLVM compatible with UNITY_BUILD would be worth the effort.

EDIT: i signed up to get access to unreal so take a look at how they do unity builds and turns out they have their own build tool (not CMake) that orchestrates the build. so does anyone know (can someone comment) whether unity builds for them (unreal) means literally one file for literally all project sources files or if it's "higher-granularity" like UNITY_BUILD in CMake (i.e., single file per object).

replies(2): >>44397636 #>>44399260 #
maccard ◴[] No.44399260{3}[source]
The build tool groups files into a roughly equivalent size based on file length, and dispatches compiles those in parallel.
replies(1): >>44399410 #
1. almostgotcaught ◴[] No.44399410{4}[source]
how many groups do people usually use to get a fast build (alternatively what is the group size)?
replies(1): >>44400955 #
2. maccard ◴[] No.44400955[source]
It’s about 300kb before pre processor expansion by default. I’ve never changed it.