Minichan

Topic: Google Chrome source code tho

Mr. Bloody Lemonade !0JqexkOGBc started this discussion #138,057

You know Google Chrome has 50 million lines of code?

That’s a random fact it’s just, web browsers are complicated but they don’t seem that complicated.

Anonymous B joined in and replied with this , 17 minutes later[^] [v] #1,461,100

• Modern OS Complexity: A web browser is no longer just a document viewer; it functions like an entire operating system.
• Core Systems: The codebase handles complex rendering engines, multi-process sandboxing for security, high-speed JavaScript execution, networking stacks, and graphic card acceleration.
• Third-Party Libraries: It includes built-in tools like PDF viewers, media codecs, and developer utilities.

Linux has 50 Million lines of code.

Google Is 2 Billion Lines of Code—And It's All in One Place.

Mr. Bloody Lemonade !0JqexkOGBc joined in and replied with this , 3 hours later, 3 hours after the original post[^] [v] #1,461,125

@previous (B)
Yeah, I heard about that. Google uses one repository for all their code. They don’t use Git though, they came up with their own version control system.

Mr. Bloody Lemonade !0JqexkOGBc double-posted this , 3 minutes later, 3 hours after the original post[^] [v] #1,461,126

JIT is pretty cool though. I was really surprised but when I tried using WASM it was actually slower than JavaScript sometimes, so I looked into it. The reason why is because browsers don’t actually interpret JavaScript anymore, instead they have a just in time compiler. But the thing about JavaScript is it’s an untyped language, but generally compiled languages like C and C++ are typed. So what it does is the runtime gathers statistics on type usages and will compile two versions of your code, one that assumes types, and one that doesn’t and it automatically figures out which version to use and constantly recompiles the source code while executing JavaScript. It’s really impressive actually, in theory it’s at least twice as slow as native code, which sounds bad, but if you think about it, it’s actually kind of incredible.

Mr. Bloody Lemonade !0JqexkOGBc triple-posted this , 1 minute later, 3 hours after the original post[^] [v] #1,461,127

But the ironic thing about it is WASM runs in a virtual machine, so because WASM is virtual it’s actually not that much faster to run C++ or Rust or something in a web browser than JavaScript, the performance is closer than you would expect.

Mr. Bloody Lemonade !0JqexkOGBc quadruple-posted this , 7 minutes later, 3 hours after the original post[^] [v] #1,461,128

It’s really cool it’s like learns how to be more efficient each time you call a function. If you measure execution times over and over, you can actually observe the optimization becoming more efficient.

Mr. Bloody Lemonade !0JqexkOGBc quintuple-posted this , 7 minutes later, 3 hours after the original post[^] [v] #1,461,130

On a hardware level, computers do something similar with machine instructions, they’re executed out of order so if you write synchronous code it will sometimes execute the instructions in parallel in a different order and they also use branch prediction. So it will guess what your code might do before it actually does it to load certain things into memory. It’s really amazing it works at all.

Anonymous D joined in and replied with this , 12 hours later, 16 hours after the original post[^] [v] #1,461,290

Ride up to my bumper, baby
https://youtube.com/watch?v=pR9DtyrTwcI
:

Please familiarise yourself with the rules and markup syntax before posting.