Live data from Hacker News

So you want to build a browser engine

robert.ocallahan.org

81–90 of 134 posts

Re: So you want to build a browser engine

#81

Earlier quoted context omitted.

>This makes writing a compiler or writing an OS kernel look like child's play. Indeed. The modern web browser is the single most advanced, complex, and highly developed piece of software that 99% of people will ever interact with, and we treat it as a given. Having a highly performant fully sandboxed VM that runs on every system imaginable in billions of devices used by nearly every human on earth is the single great…

> used by nearly every human on earth Roughly 60% of earth's population used the internet in 2023. So not quite nearly every human .

If we exclude over 75 with no interest in using it (and no use case for it in their environmnent/culture), and under 10, we're pretty close to covering all the rest.

And even the 60% is some hand wavy estimate about internet reach, about people using the internet frequently. More people use the internet than that, some transparently through some smartphone app or basic feature phone, which almost everybody has even in the poorest places in Africa.

Re: So you want to build a browser engine

#82

> So You Want To Build A Browser Engine The only correct answer is, "don't". I mean, if you want to build a toy browser engine for a CS class or fun or something, then sure. But the idea that "you want to build an engine that’s competitive with Chromium" is, quite simply, nonsensical. If you want your own browser engine, you're going to fork Chromium or Gecko (Firefox). I mean, even Microsoft gave up on maintaining i…

HTML and CSS are pretty terrible languages. Basic things like form interaction, centering, printing a page of something, overwriting every default UI, etc. often take an odd amount of LOC to make basic things.

We're collectively getting better via following the same spec, which is great, but challenging the browsers and even the spec can shed light on potentially better implementations. Let's not pigeonhole ourselves to a couple vendors just because it's easier and works _good enough_.

My favorite web design is that '90s style where text went from very left to very right, barely any CSS, and Javascript (somehow my favorite language) was for fart buttons.

I'm currently most excited about keeping up with WebRTC. And yeah, I have no interest in writing a new browser engine.

Re: So you want to build a browser engine

#83
post #6

This makes writing a compiler or writing an OS kernel look like child's play.

A browser engine is a compiler. Or, more properly, it's at least two compilers (HTML + CSS -- you can outsource JS to V8 or whatever).

It's basically an OS too. Application isolation, UI toolkit, 3D graphics APIs, storage, network stack. Netscape was right — browsers reduce the underlying OS to (a buggy set of) device drivers.

Re: So you want to build a browser engine

#84
How important is process separation if the browser engine is programmed with a memory safe language like Rust? I am under the impression that things like site separation are to bandage memory safety issues. Is that right, or are there other issues at play?

Re: So you want to build a browser engine

#85

How important is process separation if the browser engine is programmed with a memory safe language like Rust? I am under the impression that things like site separation are to bandage memory safety issues. Is that right, or are there other issues at play?

Rust does not give you protection against speculative execution attacks. Entirely different beast than memory safety errors.

Re: So you want to build a browser engine

#86
post #6

This makes writing a compiler or writing an OS kernel look like child's play.

I'd say a browser is an OS. It is, of course, higher level than a kernel like Linux that can run on the bare metal, but it has most of the aspects of a full OS.

It manages memory, processes and security, it can run user-supplied arbitrary code. It has an API, not unlike system calls that allows programs to access the underlying hardware. It doesn't do thing like writing on the address bus directly, but it does have the equivalent of drivers that are proxies to the underlying OS services for display, audio, video, etc..., which it abstracts away. Like many OSes it comes with a compiler and a shell.

Sure, it doesn't access the hardware directly through the address and data buses, like one may think an OS should do, but now that we have stuff like hypervisors, even what are unquestionably true OSes like Windows and Linux may not access the hardware directly either.

Re: So you want to build a browser engine

#87
post #68

Engine diversity is really important for the ecosystem and continued innovation. While building something competitive with the big three engines is a monumental task there's still a lot of value in building alternative engines to try new ideas even if getting "the whole web" implemented is basically impossible. For example: - Servo vs Blink vs Cobalt do selector matching and style resolution very differently. - WebKi…

But none of those differences are especially interesting. They certainly don't matter much for the ecosystem, and have no impact on web developers. All the major engines have comparable performance. And the differences are dwarfed by what they must do the same, because the way web tech works basically only allows one implementation architecture.

If you wanted to innovate in browser tech you'd really need to leave the specs behind. SCIter is an example of such an engine. It exposes APIs that are useful for app devs but that regular browsers don't have, for example it provides the vdom diffing algorithm React uses but implemented natively.

Even better if your browser can go beyond HTML and enable fully different ways to do apps and documents. That's the only place where design decisions can start to have a big impact.

Re: So you want to build a browser engine

#88
post #81

Earlier quoted context omitted.

> used by nearly every human on earth Roughly 60% of earth's population used the internet in 2023. So not quite nearly every human .

If we exclude over 75 with no interest in using it (and no use case for it in their environmnent/culture), and under 10, we're pretty close to covering all the rest. And even the 60% is some hand wavy estimate about internet reach, about people using the internet frequently. More people use the internet than that, some transparently through some smartphone app or basic feature phone, which almost everybody has even i…

Lol at under 10 and over 75 having no interest. I know avid users … content creators… in both categories.

Re: So you want to build a browser engine

#89
post #86
post #6

This makes writing a compiler or writing an OS kernel look like child's play.

I'd say a browser is an OS. It is, of course, higher level than a kernel like Linux that can run on the bare metal, but it has most of the aspects of a full OS. It manages memory, processes and security, it can run user-supplied arbitrary code. It has an API, not unlike system calls that allows programs to access the underlying hardware. It doesn't do thing like writing on the address bus directly, but it does have t…

Windows, Linux, MacOS, et al. are all just bootloaders for Chrome.

I'm joking. Maybe. Probably. It seems like we've come full circle with MS-DOS and Windows 3 in the 90s.

Re: So you want to build a browser engine

#90

This post starts with a false dichotomy: You're either making a toy browser for fun, or you're trying to make the next Chrome. There are many points in-between on that spectrum. (Look how long Microsoft IE existed, despite being highly inferior.)

More like a tautology: “if it ain’t Chrome/Safari/Firefox etc. it must be a toy”
Post reply on HN