Live data from Hacker News

Formatting a 25M-line codebase overnight

stripe.dev

51–60 of 115 posts

Re: Formatting a 25M-line codebase overnight

#52
post #7

I’m shocked at the 25M line part! That is a completely unfathomable amount of code for one codebase. I really want to know more about that.

My (much smaller than Stripe) company is well over 4.5M at this point, and the graph is very much exponential. AI has been a huge problem here: the amount of code is just exploding. Quality of the produced code is another matter.

^^^^^^^^^^^^^^^^^^^

I recently wrote a very esoteric Python script. 100 lines of code. No classes, no functions, but yes argparse.

I've tried out the latest open source models on the task. They go bananas. It's like Enterprise fizzbuzz (https://github.com/enterprisequalitycoding/fizzbuzzenterpris...). They love classes and imports and reinventing the wheel. A great way for me to tell trash AI slop code is it'll define a useful constant then 15 lines later do it again with a different name.

They love making code that looks impressive. "Wow look at all the classes and functions. It's so scalable. It's so dynamic. It validates every minutae against multiple schema and solves a problem I never thought about." But it was trash code. One really was 400 lines and it didn't even look like it would work. Can't even imagine what it means for 4.5M moderately good human lines to become what? 27M fluffy filler repeat lines that don't even make sense?

Re: Formatting a 25M-line codebase overnight

#53
post #7

I’m shocked at the 25M line part! That is a completely unfathomable amount of code for one codebase. I really want to know more about that.

I am more shocked by the "overnight" aspect. I tried running clang-format on the Chromium source (68,281 .cc files, 21 million lines according to wc):

$ find chromium-149.0.7826.1/ -name ".cc" -exec cat {} + | wc 21640925 55715244 833460441

And that took less than 6 minutes on a single E5-2696 v3 from 2014:

$ time find chromium-149.0.7826.1/ -name *.cc | parallel -j 16 clang-format $x>/dev/null

real 0m5.666s user 1m13.964s sys 0m13.373s

That’s orders of magnitude faster, especially if we assume they’re not running their workloads on potatoes like mine. Is Ruby’s syntax really that much more complicated than C++, or is this a tooling problem?

Re: Formatting a 25M-line codebase overnight

#54

One of my first jobs was a small software company writing software for a small number of clients, in MS basic PDS. The lead developer didn't like to bother with formatting code, so I wrote a tool called makenice to format his nasty spaghetti gibberish into something with good indents and layout to make it easier for us normal people to parse. He was furious, literally spun in circles about it right in the office in f…

This kind of passive-aggressive bullshit is exactly what's wrong with tech. People don't decide things: they just passively resist, and authority ends up being a muddle of truncated information flows.

Re: Formatting a 25M-line codebase overnight

#55
post #52

Earlier quoted context omitted.

My (much smaller than Stripe) company is well over 4.5M at this point, and the graph is very much exponential. AI has been a huge problem here: the amount of code is just exploding. Quality of the produced code is another matter.

^^^^^^^^^^^^^^^^^^^ I recently wrote a very esoteric Python script. 100 lines of code. No classes, no functions, but yes argparse. I've tried out the latest open source models on the task. They go bananas. It's like Enterprise fizzbuzz ( https://github.com/enterprisequalitycoding/fizzbuzzenterpris... ). They love classes and imports and reinventing the wheel. A great way for me to tell trash AI slop code is it'll def…

The bad part of LLM is it got trained on bad examples because us humans also don't know WTF we're doing.

Re: Formatting a 25M-line codebase overnight

#56

One of my first jobs was a small software company writing software for a small number of clients, in MS basic PDS. The lead developer didn't like to bother with formatting code, so I wrote a tool called makenice to format his nasty spaghetti gibberish into something with good indents and layout to make it easier for us normal people to parse. He was furious, literally spun in circles about it right in the office in f…

reminds me of rob pike mentioning gofmt's style is "no one's favorite"

Re: Formatting a 25M-line codebase overnight

#57
post #53
post #7

I’m shocked at the 25M line part! That is a completely unfathomable amount of code for one codebase. I really want to know more about that.

I am more shocked by the "overnight" aspect. I tried running clang-format on the Chromium source (68,281 .cc files, 21 million lines according to wc): $ find chromium-149.0.7826.1/ -name " .cc" -exec cat {} + | wc 21640925 55715244 833460441 And that took less than 6 minutes on a single E5-2696 v3 from 2014: $ time find chromium-149.0.7826.1/ -name *.cc | parallel -j 16 clang-format $x>/dev/null real 0m5.666s user 1m…

I don't think the post necessarily means it took multiple hours to format the codebase, I think they're probably just saying they worked on it off-hours and landed it while no one was working so that it didn't run into merge conflicts.

Re: Formatting a 25M-line codebase overnight

#58
post #53
post #7

I’m shocked at the 25M line part! That is a completely unfathomable amount of code for one codebase. I really want to know more about that.

I am more shocked by the "overnight" aspect. I tried running clang-format on the Chromium source (68,281 .cc files, 21 million lines according to wc): $ find chromium-149.0.7826.1/ -name " .cc" -exec cat {} + | wc 21640925 55715244 833460441 And that took less than 6 minutes on a single E5-2696 v3 from 2014: $ time find chromium-149.0.7826.1/ -name *.cc | parallel -j 16 clang-format $x>/dev/null real 0m5.666s user 1m…

My guess would be tooling. I think the Ruby formatters are written in Ruby. I’d guess the clang one is written in C.

Re: Formatting a 25M-line codebase overnight

#59
post #15

Earlier quoted context omitted.

That sounds even more insane to me, but I guess most of that code does not really touch financial transactions, otherwise it would be a nightmare being responsible to verify that.

Ruby code touches financial transactions. Card payments were migrated to Java when I left in 2022. Non-card payments (e.g., ACH, checks, various wallets) were still processed by Ruby. PCI-related/vaulting code lived in its own locked-down repo. I think that was a mix of Go and Ruby. Once you have the foundations in place for account balances and the ledger, processing a payment isn’t that daunting. Those foundations,…

> migrated to Java

I want to know more about this

Re: Formatting a 25M-line codebase overnight

#60
post #4

Earlier quoted context omitted.

Why is that terrifying?

ive yet to see a compelling elitist programming language opinion. especially when used at big successful companies. these companies don't function in spite of their technology choices.

The only one that worked on me wasn't even elitist in its framing.

Try TypeScript! It makes your JavaScript better!

That was enough for me.

Post reply on HN