If a Build Takes 4 Hours, Run It Every 4 Hours
pipelinedriven.org
pipelinedriven.org
Dynamic languages are also a great tool to fight build times. Even if it is unsuitable for large projects to be entirely built on dynamic languages, a great technique is using a mix of static and dynamic. Build the core of the application in a static language, but more as a set of libraries to be called from the dynamic layer. The dynamic layer is where most of the application logic resides, easy to be changed. And parts which have stabilized reasonably can still be moved over to the static part.
Firefox is further slowed down by using more and more Rust based code - Rust is known to compile slowly. However I would say this is a good tradeoff, since Rust brings much more safety to one of the most safety-critical applications on a typical desktop.
(if your building on say, a completely fresh stage3 gentoo system, that equals some pretty good linker load. cairo comes to mind as a huge culprit, whether its webkit or mozilla.)
With discipline and tracking the build time, and tools that record how long each build step takes, you can keep people from doing things like declaring a Boost multimap in a header file. They can go ahead and use it but hide it in a cpp source file behind a pointer or a virtual interface.
I've noticed that some people fall in love with C++11 move constructors, and they are pretty cool, but unlike a reference or pointer they require full type definitions in order to pass "by value." So that's annoying.
C code is definitely faster to build, unless you've got some crazy programmer who reimplemented C++ templates using five level deep nested macros.
The theory that it would makes sense to me, but I suspect other factors outshadow any effect it might have.
For example, I haven't heard that Facebook, Instacart, Booking.com, WordPress.com, etc, have stability or experience issues worse than their competitors.
And once you have type declaration that can “automatically” be checked - something has to run against the same code base to check the correctness of your code and you’re back to increasing your build time?
As written in my first post, using dynamic languages is only one way of improving development times. The other of course is, use languages which allow for fast compilation.
Indeed, type checking is rarely the slowest compilation stage for most languages.
Every web browser today includes lots of modules written in JavaScript. Every web browser today also has lots of bugs. But nobody believes that rewriting all their JS in C++ would improve the situation. For all the complaints I've ever had about Firefox/Safari/Chrome, "I got a JS TypeError" has somehow never once come up.
I’ve never in 30 years of development needed to make an adhoc dynamic language for a large system. I use Python for simple scripts and JS because you have to for the browser.
So it took several hours to get feedback for a change. But it also took about that long to come up with a new idea to try. Eventually I had a pipeline running where I could fire off a few ideas throughout the day, keep track of the change in the build, and iterate that way.
Mixing lanuages is a waste. It makes everything harder operationally, technically and business wise.
The solution to long builds is projects structure that supports caching and parallelism. No one ever changes more than couple thousands lines even in a multi million line project, so why would everything had to get rebuilt?
I've seen ci pipelines building millions of lines in under a minute, no sweat.
You can still have nice stages separations, but try to avoid the pitfall of doing too much shell invocations.
A good trick is to create a fake "multi-module reactor" pom.xml and grouping all the modules logically there, then you build like
mvn clean install -f reactor-pom.xml -T 8C
Around last year someone even managed to speed up its compilation time even further and it is also featured in Hacker News but cannot find the link now.
I think in the future most of the static typing programming languages will be mainly based on Single Static Assignment (SSA) technique then the compilation could really fly.
[1]https://www.drdobbs.com/cpp/increasing-compiler-speed-by-ove...
There was a longer discussion on one of these approaches done by Uber[1] on HN. Granted it’s a lot of investment, it’s interesting to explore ways of dealing with long builds that need to run frequently.
Provided that you can run multiple builds in parallel but each of them has somehow limited parallelization.
Also coz they don't want to add the queuing logic, so it takes 4 hours to run is an approximation. Also it messes with other systems so they prefer to run it overnight. This blog doesn't solve a real problem.
Imagine you make 5 commits in 4 hours. You now have 5 builds queued up and 20 hours of latency. So one would probably prefer to only build the last commit, and maybe queue the older commits up for later. But if you make another change then you'd need to pause the build of the older commit, or you'd be at up to 8 hours of latency instead of 4..