News for hackers. Stuff that matters.
Re:Improving code review time at Meta by comfypotato on Thursday November 17, 2022 @05:38PM (#33646952)
Am I reading this right? If the total median time in review is “a few hours”, that means that people are dropping what they’re doing to review the code. That can’t really be a good code review? A context switch alone would be half of that time for me.
Re:Improving code review time at Meta by kweingar on Thursday November 17, 2022 @05:47PM (#33647043)
I work at a company with a similar code review culture.

I have about 2 blocks of meetings per day on average. I usually check my assigned code reviews in the morning and when I come back from the meetings. Once I’m done with those then I move on to my own work.

If I have too much code review to the point that I can’t get my own work done, I take my name off the reviewer list and it’s reassigned.

On most days I’m still able to get a good 2-3 hours of sustained focused work on my own project.

Re:Improving code review time at Meta by zadjii on Thursday November 17, 2022 @06:08PM (#33647272)
> I take my name off the reviewer list and it’s reassigned.

How big is your team? We've got 4 developers on our team (and one lead), and require two signoffs for code changes. There's just not enough of us for something like that to work... right?

Re:Improving code review time at Meta by aftbit on Thursday November 17, 2022 @06:37PM (#33647581)
That doesn't sound like the best ratio to me, but I don't know what you are running or how good your deploy process is at catching issues. With a 4 person team, you are probably better off discussing risky/bigger changes as a whole team, and allowing 1 review for smaller, less risky changes with well defined rollback processes.
Re:Improving code review time at Meta by carlmr on Thursday November 17, 2022 @08:59PM (#33648846)
Also with a team so small you can't afford wasting it on meetings.

You might need focus, i.e. non-meeting days, 3 days a week.

Re:Improving code review time at Meta by flamebreath447 on Thursday November 17, 2022 @10:49PM (#33649936)
I work on similar sized teams, I introduce my PRs as stacked so they are extremely consumeable in very small bite-sized code changes and build on the last one reviewed.
Re:Improving code review time at Meta by RussianCow on Friday November 18, 2022 @01:46AM (#33651206)
Do you use any special tools for this? I've heard of people "stacking" diffs in this way, but it seems like it would be clunky to review on GitHub.
Re:Improving code review time at Meta by return_to_monke on Friday November 18, 2022 @03:29AM (#33651903)
This is one of the features of (yes), Meta's sapling VCS. https://sapling-scm.com/docs/introduction/getting-started/
Re:Improving code review time at Meta by Dunedan on Saturday November 19, 2022 @08:23AM (#33669809)
If you work directly in the source repository that works actually really well on Github (if everybody works on its own fork instead, you're unfortunately out of luck). When opening a pull request, you just select the branch the pull request should be based on to be the previous branch in your stack. If one of those pull requests gets merged, Github will automatically rebase the stacked on onto the base branch. This way every pull requests contains exactly the changes you want it to contain, while you're still being able to stack changes by opening multiple pull requests, with each one being based on the branch of the previous one.
Re:Improving code review time at Meta by kevingoslar on Saturday November 19, 2022 @08:26PM (#33677091)
Re:Improving code review time at Meta by newaccount74 on Friday November 18, 2022 @04:40AM (#33652440)
So every change needs to be seen by 3 out of 5 people (assuming the lead also does code review)? That sounds a bit inefficient.
Re:Improving code review time at Meta by HereBeBeasties on Friday November 18, 2022 @03:50AM (#33652047)
I think your main issue is having "two blocks of meetings" a day as a developer. That sounds absolutely nuts to me. Even two meetings a day is likely too much for a dev, let alone two blocks of meetings! I'd start by reducing that.
Re:Improving code review time at Meta by radiKal07 on Friday November 18, 2022 @04:01AM (#33652135)
> I have about 2 blocks of meetings per day on average

Are you sure you are a developer?

Re:Improving code review time at Meta by shortstuffsushi on Thursday November 17, 2022 @05:51PM (#33647086)
If I read it right, it described there being a "code review team." Whether they're responsible for reviewing all code, or just for coming up with these sorts of practices was not clear. ETA: with that said, the "reviewer recommender" to me would imply it's people who work on the same codebase.
Re:Improving code review time at Meta by rb2k_ on Thursday November 17, 2022 @07:01PM (#33647813)
Nah, a dedicated "code review team" is not a thing.

Often the suggestion featured does suggest a whole team as a review based on code ownership.

Re:Improving code review time at Meta by PAREL on Friday November 18, 2022 @03:07AM (#33651768)
rb2k
Re:Improving code review time at Meta by comfypotato on Saturday November 19, 2022 @12:23AM (#33667221)
The code review team is about the code review process I think; as opposed to being reviewers. Such would be the nature of a peak industry company.
Re:Improving code review time at Meta by ummonk on Thursday November 17, 2022 @06:09PM (#33647275)
Working there I tended to conduct code reviews each afternoon at the end of work. Sometimes after coming back from lunch as well. There isn't any "drop what they're doing" involved.
Re:Improving code review time at Meta by pavon on Thursday November 17, 2022 @06:29PM (#33647496)
Sure, I do reviews first thing every morning, and sometimes right after lunch (mostly just rereviews), but that would give a mean/median response time of 4 hours assuming work completion time is uniformly distributed. And if changes are requested, that would add another 2-4 hours, which brings the total review-in-wait time to a full day, which the post was saying was unacceptable. To get the numbers they claim they must be reviewing more frequently than that.
Re:Improving code review time at Meta by disgruntledphd2 on Friday November 18, 2022 @04:00AM (#33652126)
You can use timezones to your advantage here. When California is finishing, Singapore is starting and when Singapore is finishing London is starting.
Re:Improving code review time at Meta by gtirloni on Friday November 18, 2022 @04:07AM (#33652176)
Why would you do that unless it's a hotfix or something really critical? Are the costs negligible?
Re:Improving code review time at Meta by disgruntledphd2 on Friday November 18, 2022 @05:25AM (#33652765)
So, it depends. When I was at FB, we had one person in Europe (me), one in SF and one in Asia.

Organising the diffs in this way made it much, much easier to collaborate.

Given how much FB has grown since then, I suspect this would be even easier, and this is how the numbers noted above are what they are.

Re:Improving code review time at Meta by ummonk on Friday November 18, 2022 @02:57PM (#33661133)
Every team member doesn't do their review at the same time. You're likely to get a review within a few hours, which means total review time (they're only counting the time it's waiting for a review) is unlikely to be a whole day.
Re:Improving code review time at Meta by comfypotato on Friday November 18, 2022 @04:49AM (#33652517)
Which is what I expect. This doesn’t really agree with “a few hours” which is why I was confused.
Re:Improving code review time at Meta by ummonk on Friday November 18, 2022 @03:00PM (#33661182)
It's perfectly consistent with a few hours, given that different team members tend to review diffs at different time during the day.
Re:Improving code review time at Meta by joshuamorton on Thursday November 17, 2022 @06:17PM (#33647356)
If the average change is small, it's not a particularly challenging thing to take 5 minutes to review something. (for context, my median change, both mailed and reviewed, is under 50 LoC, though this will depend on language, e.g. Java is notably more boilerplate-y than the languages I usually use, and I do a lot of configuration changes that are 1-3 lines by nature).

Picking up a 5 minute review after you've returned from some existing context switch (a meeting, coffee, conversation, lunch, etc.) is easy enough.

As a result, around 25% of my reviews are done within an hour, and 10% within 10 minutes. I'm a slightly fast reviewer, but approximately the same applies to reviews done of my code. And that includes reviews that require interaction with peers in Europe, which obviously require much longer because they can be mailed while I'm asleep or the reverse.

Re:Improving code review time at Meta by TillE on Thursday November 17, 2022 @06:25PM (#33647453)
Yeah if it's a change to code you're deeply familiar with, that's not much of a context switch. In that situation, working on your own stuff or reviewing someone else's code feels basically the same, unless one of you is doing something very wrong.
Re:Improving code review time at Meta by comfypotato on Saturday November 19, 2022 @12:21AM (#33667213)
10 minutes of work to review is fascinating to me. I’m somewhat of a baby programmer, and that’s over my head a bit I think.
Re:Improving code review time at Meta by bagels on Thursday November 17, 2022 @06:22PM (#33647408)
Meta had the best code review quality I've seen in my career.
Re:Improving code review time at Meta by nomel on Thursday November 17, 2022 @07:06PM (#33647866)
As someone who has only experienced terrible code reviews, could you give a little summary of what you liked?
Re:Improving code review time at Meta by antiterra on Thursday November 17, 2022 @08:18PM (#33648507)
They probably had some pretty good cat meme image macros.
Re:Improving code review time at Meta by bagels on Thursday November 17, 2022 @08:52PM (#33648800)
Yes good meme macros too. I left a few in my wake.
Re:Improving code review time at Meta by bagels on Thursday November 17, 2022 @08:51PM (#33648797)
Calling you out for lazy work. Teaching you how to use internal tools, company coding standards, suggesting better patterns, digging deep in to the context of system design and maintainability, suggesting other domain experts to tag in the reviews. I learned all sorts of Hack things that obviously I wouldn't learn outside from code reviews.
Re:Improving code review time at Meta by jackblemming on Friday November 18, 2022 @12:49AM (#33650887)
Then why have they produced some of the most garbage software imaginable?
Re:Improving code review time at Meta by dieselgate on Friday November 18, 2022 @01:16AM (#33651027)
Boo, please consider a review of the HN comment guidelines https://news.ycombinator.com/newsguidelines.html

Could you potentially explain what makes it "some of the most garbage software imaginable"?

edit: wording

Re:Improving code review time at Meta by jackblemming on Friday November 18, 2022 @01:28AM (#33651086)
There's already many articles posted to hackernews frequently at the insane internals of the mobile app, to the "meta verse", to many other things. Most of which are posted by ex-Facebook engineers. I don't need to rehash the same conversations, nor do I need to grant Facebook of all corporations any sort of courtesy.
Re:Improving code review time at Meta by gtirloni on Friday November 18, 2022 @04:09AM (#33652197)
The courtesy is towards us, people engaging in this discussion. Meta is not a party here.
Re:Improving code review time at Meta by RussianCow on Friday November 18, 2022 @01:51AM (#33651248)
Name one successful company that only produces beautiful, elegant, and readable code, with no nasty warts or hacks.

I'll wait.

Re:Improving code review time at Meta by KronisLV on Friday November 18, 2022 @06:30AM (#33653185)
> Name one successful company that only produces beautiful, elegant, and readable code, with no nasty warts or hacks.

Honestly, I'd genuinely like to hear some of the answers to this, or even just mentions of good codebases to explore.

That said, I don't think that there will be that many that satisfy all of the requirements listed here, because as the scope of a project grows, there will almost inevitably be some technical debt or accidental complexity, or even subjective things.

Re:Improving code review time at Meta by bagels on Friday November 18, 2022 @02:09AM (#33651363)
I mean, I generally think comments with this kind of attitude aren't looking for serious responses, so I normally don't respond.

That said, there are three things to consider: 1) I honestly don't care whether you think it's garbage or not. 2) I saw some amazing software there, and I saw some that wasn't amazing. 3) It's an immense business, and there is a certain amount of inherent dysfunction that comes with that many people working on anything together much as you would see at any large company.

Re:Improving code review time at Meta by dieselgate on Friday November 18, 2022 @01:20AM (#33651053)
How are small things like "you left a commented out print/log" or "use color var not hex code" handled - or that a 'company coding standards' type thing. Are those types of things potentially automated with a linter or similar?
Re:Improving code review time at Meta by yodsanklai on Thursday November 17, 2022 @07:38PM (#33648171)
Most reviews can be done quite quickly. Small changes, test plan is convincing, low potential to break things. Besides, if engineers are good, code is easier to review.
Re:Improving code review time at Meta by Jensson on Thursday November 17, 2022 @07:39PM (#33648180)
Slow reviews means that you need to context switch a lot to answer their review suggestions and resubmit the review, that is much worse for productivity than taking a few minutes to go and look through what a teammate is doing now and then.

Alternatively your code review culture doesn't give a lot of suggestions for changes before submission, and that leads to more technical debt which will produce bad results long term.

Re:Improving code review time at Meta by H8crilA on Thursday November 17, 2022 @07:42PM (#33648206)
If you're working 8 hours and do at least 4 breaks per day - that's a break every 2 hours. If you do a break you might as well skim through emails and do some reviews. And remember that everything* is Pareto distributed, the review request sizes too. It's really not hard at all.

[*] it's an exaggeration, but close to reality.

Re:Improving code review time at Meta by screamingninja on Thursday November 17, 2022 @08:02PM (#33648386)
> If you do a break you might as well skim through emails and do some reviews.

That's not exactly a break...

Re:Improving code review time at Meta by H8crilA on Thursday November 17, 2022 @09:03PM (#33648878)
Well, after or before the break. The point is you're going to lose context completely anyhow.

And I'd like to stress the distribution of the "complexity of a review", which you can crudely approximate with something like number of lines changed. Most of them will be small.

Re:Improving code review time at Meta by pavon on Thursday November 17, 2022 @10:14PM (#33649564)
When I'm on a break, I'm pretty much always mulling my task on the back of my mind, and doing things that don't require concentration, so when I get back from the break I'm still in the same frame of mind. Doing code reviews definitely forces a sharper shift of mind and takes longer to switch back from than a break does. Sometimes it is worthwhile, but it does have a cost.
Re:Improving code review time at Meta by BurningFrog on Thursday November 17, 2022 @10:09PM (#33649520)
People don't like when I say this, but I think it's true:

If it typically takes you hours to "get inside" some code, that code is way too complicated.

Re:Improving code review time at Meta by RussianCow on Friday November 18, 2022 @01:54AM (#33651266)
Some problems are inherently difficult to understand, let alone solve. I'm inclined to believe that engineers at Meta solve a lot of these types of problems.
Re:Improving code review time at Meta by BurningFrog on Friday November 18, 2022 @03:03PM (#33661226)
You can solve difficult problems with simple, well factored code.

Just like your can solve simple problems with spaghetti code.

Of course, writing simple, will factored code is often hard!

Re:Improving code review time at Meta by ohgodplsno on Friday November 18, 2022 @04:20AM (#33652269)
Having thousands of engineers tends to help on that. If there's a 5% chance one engineer is available in the next two hours after you post a PR, with a team of 10 you will probably have none, with a team of 1000 you will easily get some.
Re:Improving code review time at Meta by zeckalpha on Friday November 18, 2022 @05:38AM (#33652871)
Pairing can sidestep both of these problems. No context interruption and reviewed continuously.
Re:Improving code review time at Meta by francis-io on Friday November 18, 2022 @06:09AM (#33653053)
I have found that when you pair it's easy for both people to lose sight of some greater context. You become one big mind and become susceptible to as many blindspots as an individual.