News for hackers. Stuff that matters.
Re:A one-line change decreased our build times by 99% by JOnAgain on Sunday October 25, 2020 @09:31PM (#24891944)
I think it takes some real humility to post this. No doubt someone will follow up with an “of course...” or “if you don’t understand the tech you use...” comment.

But thank you for this. It takes a bit of courage to point out you’ve been doing something grotesquely inefficient for years and years.

Re:A one-line change decreased our build times by 99% by projektfu on Sunday October 25, 2020 @09:56PM (#24892104)
I'd be interested to know how they came to realize what was missing. Did they read the Jenkins docs more thoroughly? Post on a mailing list? See something on StackOverflow? Hire a consultant?
Re:A one-line change decreased our build times by 99% by pushrax on Sunday October 25, 2020 @10:18PM (#24892250)
I would expect that internally someone profiled the build (i.e. looked at timestamps) and then either profiled git, or just looked at the logs and did some guessing/research. This didn't seem like it would be complicated to find once you realize the time is spent in git.

Also, this probably has been an exponentially increasing problem, and wasn't really a priority to solve until relatively recently. I would bet there are a lot of stale undeleted branches.

Re:A one-line change decreased our build times by 99% by marta_morena_28 on Sunday October 25, 2020 @11:53PM (#24892692)
It really doesn't sound complicated to find, unless you just have a handsoff approach to building things and just don't care as long as "something" comes out on the other end.

What makes me wonder however is this: 40 min made them look into this? I mean 40 min is crazy long. What builds this long? Chrome, Windows, Linux Kernel on a single core? This should have been raising red flags much earlier. The only explanation I can come up with is that the whole build takes hours anyway, otherwise there is no way you wouldn't notice this sooner.

Re:A one-line change decreased our build times by 99% by detaro on Monday October 26, 2020 @03:36AM (#24893654)
Remember "build" time likely also includes test runs, packaging for deployment, ... 40 mins is easy to get to, and has nothing to do with "on a single core".
Re:A one-line change decreased our build times by 99% by sumedh on Monday October 26, 2020 @08:39AM (#24895471)
You can still see which stages are taking a long time.
Re:A one-line change decreased our build times by 99% by jeromenerf on Monday October 26, 2020 @08:51AM (#24895593)
I wonder if people went into the habit of synchronizing git pushes with socializing breaks, with the proverbial excuse of "yeah, compiling ...".

On day, someone forgot to brief the foreign intern about the necessity of breaks, intern fixes the issue, pointy-hair-boss gets wind of the news, old crew gets fired, new intern gets promoted and fixes also the Pinterest spam on google images.

Re:A one-line change decreased our build times by 99% by znpy on Monday October 26, 2020 @09:10AM (#24895755)
> new intern gets promoted and fixes also the Pinterest spam on google images

A man can dream.

Re:A one-line change decreased our build times by 99% by pushrax on Monday October 26, 2020 @12:28AM (#24892832)
It takes >12h to build Windows on the MS build platform.

On a single core, Chromium surely takes hours to build.

Though I agree that 40min for the repository in question is highly suspect.

Re:A one-line change decreased our build times by 99% by masklinn on Monday October 26, 2020 @02:45AM (#24893407)
> On a single core, Chromium surely takes hours to build.

Earlier this year Bruce Dawson had a post indicating that it took about a CPU-day, though coalescing files (“jumbo builds”) significantly reduces build time (we’re talking down to 5h), however that’s at the expense of incremental building, and it constrains the code as you can get symbol collisions between the coalesced files.

Re:A one-line change decreased our build times by 99% by Dylan16807 on Monday October 26, 2020 @05:57AM (#24894413)
I read that comment as only applying the "single core" part to the Linux kernel, not Chromium.
Re:A one-line change decreased our build times by 99% by maccard on Monday October 26, 2020 @04:25AM (#24893894)
I work in games, a clean sync of our project takes well over an hour (and if you're at home it takes multiple hours), and compiling takes a large amount of time. We use lots of tricks - "unity" builds with out build system detecting modified files and compiling them standalone as an example. On my last workstation (2x intel xeon gold) it took about 30 minutes to compile
Re:A one-line change decreased our build times by 99% by oefrha on Monday October 26, 2020 @12:08AM (#24892745)
Yep, I’m shocked that it had to be bloated to 40min before they even thought about fixing it. Anyone who has used Jenkins for nontrivial builds must have had the experience of staring at the slowly expanding session log screen? It doesn’t take any “profiling” to realize git clone’s taking forever.
Re:A one-line change decreased our build times by 99% by ImprovedSilence on Monday October 26, 2020 @09:04PM (#24903482)
I remember hearing facebook was on the order of hours (6+) to build.
Re:A one-line change decreased our build times by 99% by jeromenerf on Monday October 26, 2020 @04:23AM (#24893886)
I would bet on "the new recruit found it, 45 minutes in in the onboarding process".
Re:A one-line change decreased our build times by 99% by conradludgate on Monday October 26, 2020 @05:22AM (#24894245)
My first task at my current job, after familiarising myself with the codebase was to improve the CI pipeline
Re:A one-line change decreased our build times by 99% by Aloha on Monday October 26, 2020 @11:48AM (#24897456)
I think everyone has done this, sometimes it really does take a second set of eyes
Re:A one-line change decreased our build times by 99% by ric2b on Thursday November 05, 2020 @06:25AM (#24997316)
In my experience it only takes someone who is not drowning in a backlog of tasks yet.

That tends to be the beginners during the onboarding weeks.

Re:A one-line change decreased our build times by 99% by koliber on Friday October 30, 2020 @04:54AM (#24940374)
The beauty and power of the beginner's mind.

It can see things that were there all along, but everyone who has been there has developed a blindness to.

Re:A one-line change decreased our build times by 99% by bluedino on Monday October 26, 2020 @09:43AM (#24896068)
I see this kind of stuff at companies where only one or two developers work on a project, or the team working on it hasn't had much experience on other projects.

An example would be a company I worked for who ran a pretty standard LAMP setup but had never heard of memcached. Simply adding that reduced the database load by like 90%.

Re:A one-line change decreased our build times by 99% by aeyes on Monday October 26, 2020 @12:36PM (#24898042)
The same way it always happens to me: Over time build time creeps up and you don't really look at this code thinking "I implemented shallow clone years ago so there is nothing I can do, it's slower because we have more code."

Until you or some other person looks what the code is doing.

It could also be that it was a new hire. I shallow clone a huge monorepo similar in commits/branches and it takes seconds. My experience would instantly tell me that something is worth looking into.

[dead]
Re:A one-line change decreased our build times by 99% by jedberg on Sunday October 25, 2020 @10:13PM (#24892220)
Why are you so angry about this? You've commented throughout this post about how this is boring and the Pinterest team is incompetent. Why?

I found it quite interesting. I've been working in deployments for over 20 years at some pretty big places, and never really though about this before. I now have a new tool in my toolbox, and I'm quite happy about it.

Re:A one-line change decreased our build times by 99% by hashkb on Sunday October 25, 2020 @10:26PM (#24892292)
In general I'm frustrated that rigor, standards, etc are out the window in favor of all this warm fuzziness. I guess I might be angry...

The culture change in our industry, towards warm fuzzies and away from tech screens, results in calculable waste. Time, money, electricity, customers. We lose good engineers and tell ourselves they were a bad fit. We push crap on users just to sell ads. Then we write engineering posts to brag about fixing our own mistakes. It's a terrible shame and I speak up about it to remind everyone there was a time when RTFM would be the only response to this.

Edit: rate limited but one last thing: are we this forgiving of Equifax when they oopsie our data? Seeing this would immediately make me wonder if anything I have shared with Pinterest is safe. That's why they owe us a postmortem and not a thirst trap.

Re:A one-line change decreased our build times by 99% by m45t3r on Sunday October 25, 2020 @11:16PM (#24892547)
> are we this forgiving of Equifax when they oopsie our data?

The kind of culture you're in favor for, blaming engineer for mistakes and punishing them, is exactly what makes the kinda of Equifax mistake possible. Suddenly, people stop to improve things and just do the minimum possible so they can keep their job, since anything else can cause a mistake that will cost your next performance cycle (or even worse, your job).

Re:A one-line change decreased our build times by 99% by stjohnswarts on Sunday October 25, 2020 @11:40PM (#24892630)
I know I have certainly left cans of worms close various companies because I knew there was only risk and no reward even though I would have loved to tackle the problem. Fix a major problem working late and weekends and get an attaboy at the weekly conference. Do a good job but introduce a bug that is relatively minor but causes a slight delay in deployment and get on the manager's shit list for the rest of your time there.
Re:A one-line change decreased our build times by 99% by hashkb on Monday October 26, 2020 @03:02PM (#24899852)
I'm talking about blaming and punishing management, not engineers. I'm sorry that wasn't clear.
Re:A one-line change decreased our build times by 99% by phist_mcgee on Sunday October 25, 2020 @10:39PM (#24892367)
1. You seem to be projecting a lot of your own thoughts and biases onto this article, and this discussion.

2. RTFM made sense when you wrote code in one terminal window and compiled it in another and then shipped a CD. There is no way you can RTFM for every tool you use at a modern software company. NO ifs ands or buts, it just is not happening. It sounds like you are looking at a nostalgic view of the past, and not understanding the context of the scope and scale of software that is built these days.

3. Engineers should be encouraged to share their learnings with each other to collectively 'raise the tide'. I will never pooh pooh a development team wanting to share their learnings, even if you may or may not think it was a good idea, it may have helped their team or someone reading the article.

4. We've been pushing crap to sell ads since advertising began, grow up and take a longer look, the technology has complicated it, but it's still the same as it always was.

Re:A one-line change decreased our build times by 99% by unishark on Monday October 26, 2020 @02:21AM (#24893286)
I personally do think there is a systemic problem in companies trying to hire the bare minimum in skills/experience for technical roles and ending up with people operating right at the limit of their abilities (and intermittently being in over their heads).

But do I agree RTFM is frustrating advice for a lot of things. Especially if you aren't going to use such information often enough, so will keep forgetting it anyway and have to start over with the manual each time.

Re:A one-line change decreased our build times by 99% by corpMaverick on Monday October 26, 2020 @10:58AM (#24896830)
> But do I agree RTFM is frustrating advice for a lot of things. Especially if you aren't going to use such information often enough, so will keep forgetting it anyway and have to start over with the manual each time.

This is related to one of biggest frustrations in the last ten years. We used to master the tool set. But now there are so many tools. Some of them we don't used them often enough. I find myself doing a lot of guessing whereas before I knew what was going on at every step.

Re:A one-line change decreased our build times by 99% by pavel_lishin on Sunday October 25, 2020 @10:32PM (#24892338)
> The culture change in our industry, towards warm fuzzies and away from tech screens, results in calculable waste.

I have not noticed, in the past decade, any move away from tech screens whatsoever.

Re:A one-line change decreased our build times by 99% by uglycoyote on Monday October 26, 2020 @10:25AM (#24896476)
Are we talking about technological screens, like LCD screens here?
Re:A one-line change decreased our build times by 99% by xdavidliu on Monday October 26, 2020 @10:46AM (#24896702)
I believe they mean screens in the sense of technical interviews to assess candidates' technical ability.
Re:A one-line change decreased our build times by 99% by Aeolun on Sunday October 25, 2020 @09:47PM (#24892043)
I don’t know, I consider myself fairly competent but I’d never even considered that. It’s just not so relevant until your repo is multiple gigabytes big.

Still, I’ll see if it works for our pipelines, and we can get our clone from 20s to 1s

Re:A one-line change decreased our build times by 99% by hashkb on Sunday October 25, 2020 @09:49PM (#24892055)
Good teams profile everything. This team's only goal is to support other engineers. Build time is a huge issue for every ops team. Missing this for so long is wasted money that's easy to calculate. We can be nice to people while still having high standards. It's a missed opportunity for a deeper postmortem, and it's bland content at best.
Re:A one-line change decreased our build times by 99% by jacquesm on Monday October 26, 2020 @03:22AM (#24893593)
I think you live in a highly theoretical parallel universe. The one I occupy is the one where 'good teams' profile those things that take too long.

Take yourself as an example: in spite of the wide availability of free certificates you are still hosting your domain without using a secure transport layer. Some would take that as incompetence. Others would assume you have more stuff on your plate rather than that you don't have high standards.

Re:A one-line change decreased our build times by 99% by sdoering on Monday October 26, 2020 @03:46AM (#24893712)
And others would assume, that there are other philosophies out there regarding ssl everywhere. So the question is, who's POV has more validity and logical rigor attached to it. I actually can't see any side winning here on a purely logical level. Only on an ideological level. At least as long as we are talking about consuming public information.

Am I in favor of the aggressiveness of OP in other posts? No. Am I using SSL myself. Hell yes.

Nonetheless, I understand that there are people who feel that consuming public information like on a private homepage is nothing that necessitates using SSL. Even if I myself have a different ideology/value set governing my decision.

I once heard the comparison that it is like the difference of sending a letter and sending a picture postcard. Not sure if I buy into that, but I can't argue against it on a purely rational basis.

Re:A one-line change decreased our build times by 99% by hashkb on Tuesday November 03, 2020 @01:53PM (#24982701)
Yes, it's by choice. It's read only, public information. We don't set cookies or anything.

We take security very seriously. But we don't take anything too seriously.

Edit: by the way, persuade me that there's an upside and I'll turn it on.

Re:A one-line change decreased our build times by 99% by dmurray on Monday October 26, 2020 @10:09AM (#24896307)
> The one I occupy is the one where 'good teams' profile those things that take too long.

Deciding which things take too long is profiling. Maybe you do it in your head or with pencil and paper instead of using a software approach but I think your position aligns with "good teams profile everything".

Re:A one-line change decreased our build times by 99% by argc on Sunday October 25, 2020 @09:50PM (#24892059)
This is neither incompetence nor surprising. Maybe you’ve only worked at large companies who have had time to optimize things for years (and even then, I see grotesque software decisions at my large company quite often). Try accepting that software is often written poorly optimized on the first pass, for good reason, and learn to celebrate the wins without needing to shame someone.
Re:A one-line change decreased our build times by 99% by hashkb on Sunday October 25, 2020 @09:54PM (#24892088)
This is Pinterest. Every org I've worked at has been smaller. There's space between shame and ignoring mistakes.

The purpose of this post is not to educate. There's nothing in here that anyone can use to improve. It's just marketing.

Re:A one-line change decreased our build times by 99% by phist_mcgee on Sunday October 25, 2020 @10:41PM (#24892383)
Well I learned something from this article, and I thought I had a good handle on CI/CD, so either I am incredibly stupid and shouldn't be reading these 'nothing' articles, or maybe there is so much to learn it's impossible to know it all.
Re:A one-line change decreased our build times by 99% by sytringy05 on Sunday October 25, 2020 @11:29PM (#24892589)
If you dont have massive repos, then this is the sort of thing that not often a big problem. Also - if you are using things like gitlab runners, you might be in the same AZ and even large repos clones are fast.

And it is impossible to know it all, I like these articles just for the differing ways people work

Re:A one-line change decreased our build times by 99% by phist_mcgee on Monday October 26, 2020 @02:18AM (#24893268)
It sounds like GP has a bit of a chip on their shoulder when it comes to feeling like you're not worthy if you don't know everything.
Re:A one-line change decreased our build times by 99% by stjohnswarts on Sunday October 25, 2020 @11:43PM (#24892644)
Are you just an angry ex Pinterest employee? There is something to learn here and a reminder to pay more attention even when you're knee deep in other tasks. Besides the obvious feature/limitation of git that the author points out.
Re:A one-line change decreased our build times by 99% by kevinventullo on Sunday October 25, 2020 @10:22PM (#24892277)
A team discovers a major efficiency win requiring minimal engineering effort and your response is to... punish them?
Re:A one-line change decreased our build times by 99% by swsieber on Sunday October 25, 2020 @09:54PM (#24892084)
People praise my git skills at work (among other things) when they come to me for git help.

My response is always the same: I've just run into these bugs more often than they.

Re:A one-line change decreased our build times by 99% by Hnrobert42 on Sunday October 25, 2020 @10:24PM (#24892284)
Shocking? Incompetent? A hiring postmortem? Really? AYFKM?
Re:A one-line change decreased our build times by 99% by ponker on Sunday October 25, 2020 @10:11PM (#24892203)
They did a billion dollars of revenue last year, their management and hiring systems seem to be getting the job done.
Re:A one-line change decreased our build times by 99% by sk5t on Sunday October 25, 2020 @10:40PM (#24892375)
Yep--although multiple unpleasant experiences with pinterest have spurred me to permaban it from search engine results and smite it with network filters, somewhat wasteful CI/CD pipelines have clearly not prevented the company from flourishing.
Re:A one-line change decreased our build times by 99% by bald42 on Monday October 26, 2020 @05:37AM (#24894322)
I don't get why they have to clone their repo frequently in the first place - seems to me as a brute force usage of a version control system prone to high cost in the first place.
Re:A one-line change decreased our build times by 99% by rightbyte on Monday October 26, 2020 @07:04AM (#24894825)
It is a nice and fool proof way to get a clean working environment to just download everything from nothing. And you want different working folder for different jobs anyway so they don't mess with eachother or build of state between jobs due to scripting messups.
Re:A one-line change decreased our build times by 99% by ForHackernews on Monday October 26, 2020 @05:55AM (#24894399)
I don't know about a big org like Pinterest, but it's pretty common for "clone the repo" to be the first step of a CI/CD pipeline when using something like CircleCI or GitlabCI.

It's an easy (if inefficient) way to always get the latest changes and if you have disposable build-runners then it all gets thrown away at the end of the pipeline.

Re:A one-line change decreased our build times by 99% by DougBTX on Monday October 26, 2020 @07:24AM (#24894946)
It is interesting that we trust our tools so little. A git hash is a pretty robust way to know whether the code in the repo is what it is supposed to be, so a "git fetch" rather than a fresh "git clone" should be safe, but we can't trust the build steps to not trash the build-runner so the entire thing needs to be thrown away.

Edit: for context, I wrote this comment while waiting for `npm ci` to run. Its first step is to delete the node_modules folder, as otherwise it can't be trusted to update correctly.

Re:A one-line change decreased our build times by 99% by ForHackernews on Monday October 26, 2020 @07:33AM (#24894992)
> we can't trust the build steps to not trash the build-runner so the entire thing needs to be thrown away.

I think it's partly this, and partly that everything is shared infrastructure now. I don't want to pay to keep a machine up 24/7 just to use it to run a build for 10 minutes half a dozen times per day.

So instead I lease time on shared hardware with ephemeral "containers" or "virtual machines" or whatever.

Re:A one-line change decreased our build times by 99% by user5994461 on Monday October 26, 2020 @07:31AM (#24894978)
Jenkins has a setting to keep the checkout directory (default) or to clear the directory between builds.

At last job, the default was letting broken changes pass the build, they break some step of the setup/run process that's not run on a partial build. New joiners came in and they couldn't build because the build was broken.

Had to fix it by setting up two jobs, one running from scratch (30 minutes) and one incremental (10 minutes). The build from scratch was catching a broken change or two every week.

Re:A one-line change decreased our build times by 99% by mschuster91 on Monday October 26, 2020 @05:53AM (#24894392)
Ephemeral CI runners. I have the same problem at work - 4GB repository that is redownloaded on every single pipeline run.

Another reason (which is why we went for ephemeral runners in the first place...) is that if you have stuff that mounts a directory from the repository directory as a volume in a Docker container (e.g. for processing data), you may end up with the Docker container frying permissions in the repo folder (e.g. 0:0 owned files). Now, you can put a cleanup step as part of the CI (=docker run --rm -v $(pwd):/mnt sh -c 'chown -R $runner_uid:$runner_gid)... but unfortunately, Gitlab does not allow a "finally" step that always gets run, so in case the processing fails, the build gets aborted, the server hosting the runner crashes, ... anything happens, the permissions will be fried, and a sysadmin will need to manually intervene.

An ephemeral runner using docker:dind however? It simply gets removed.

Re:A one-line change decreased our build times by 99% by mytailorisrich on Monday October 26, 2020 @09:42AM (#24896044)
In order to start with a clean slate and to guarantee state and absence of artefacts from previous builds/pulls it is common practice to start off with a clean directory.