Live data from Hacker News

Lightpanda migrate DOM implementation to Zig

lightpanda.io

61–70 of 144 posts

Re: Lightpanda migrate DOM implementation to Zig

#62

it's so tiring that every time there's a post about something being implemented in Zig or C or C++, the Rust brigade shows up trying to pick up a fight.

Maybe just a reflex by people that had to hear a decade of "why not C++" whenever it was mentioned that Rust is being used?

Re: Lightpanda migrate DOM implementation to Zig

#63
post #48
post #47

Earlier quoted context omitted.

> 1. more compile-time safety is always better, even if it complicates the language (or everyone who uses Rust should use ATS), and 2. any cost is worth paying for safety (or Rust wouldn't exist in the first place). You keep repeating this. It's not true. If what you said was true, Rust would have adopted HKT, and God knows whatever type astronomy Haskell & Scala cooked up. There is a balancing act, and Rust decided…

Rust does have a GC, but I agree it planted its flag at some intermediate point on the spectrum. Zig didn't "go backwards" but planted its own flag ever so slightly closer to C than to ATS (although both Rust and Zig are almost indistinguishable from C when compare to ATS). I don't know if where Rust planted its flag is universally better than where Zig planted its flag, but 1. no one else does either, 2. both are co…

> Rust does have a GC

It doesn't. Not by any reasonable definition of having a GC.

And "opt-in non-tracing GC that isn't used largely throughout the standard library" is not a reasonable definition.

> Nobody knows whether Rust's compormise is universally better than Zig's

When it comes to having more segfaults, we know. Zig "wins" most segfaults per issue Razzie Award.

This is what happens when you ignore one type of memory safety. You have to have both. Just ask Go.

Re: Lightpanda migrate DOM implementation to Zig

#64
post #8

This table is informative as to exactly what lightpanda is: https://lightpanda.io/blog/posts/what-is-a-true-headless-bro... TL;DR: It does the following: - Fetch HTML over the network - Parse HTML into a DOM tree - Fetch and execute JavaScript that manipulates the DOM But not the following: - Fetch and parse CSS to apply styling rules - Calculate layout - Fetch images and fonts for display - Paint pixels to render th…

When I was working before on something that used headless browser agents, the ability to do a screenshot (or even a recording) was really great for debugging... so I am not sure about the "no paint". But hey everything in life is a trade-off.

Really depends on what you want to do with the agents. Just yesterday I was looking for something like this for our web access MCP server[0]. The only thing that it needs to do is visit a website and get the content (with JS support, as it's expected that most pages today use JS), and then convert that to e.g. Markdown.

I'm not too happy with the fact that Chrome is one of our memory-hungriest parts of all the MCP servers we have in use. The only thing that exceeds that in our whole stack is the Clickhouse shard, which comes with Langfuse. Especially if you are looking to build a "deep research" feature that may access a few hundreds of webpages in a short timeframe, having a lightweight alternative like Lightpanda can make quite the difference.

[0]: https://github.com/EratoLab/web-access-mcp

Re: Lightpanda migrate DOM implementation to Zig

#66
post #21

A language which is not 1.0, and has repeatedly changed its IO implementation in a non-backwards-compatible way is certainly a courageous choice for production code.

Right? People must really like the design choices in Zig to do that instead of choosing another language. It's very interesting just because of that.

Re: Lightpanda migrate DOM implementation to Zig

#68
post #3

Earlier quoted context omitted.

Hi, I am Francis, founder of Lightpanda. We wrote a full article explaining why we choose Zig over Rust or C++, if you are interested: https://lightpanda.io/blog/posts/why-we-built-lightpanda-in-... Our goal is to build a headless browser, rather than a general purpose browser like Servo or Chrome. It's already available if you would like to try it: https://lightpanda.io/docs/open-source/installation

Respectfully, for browser-based work, simplicity is absolutely not a good enough reason to use a memory-unsafe language. Your claim that Zig is in some way safer than Rust for something like this is flat out untrue.

In that blog post, the author said safer than C not Rust.

Re: Lightpanda migrate DOM implementation to Zig

#69
post #29

Earlier quoted context omitted.

I don't think that a language that was meant to compete with C++ and in 10+ years hasn't captured 10% of C++'s (already diminished) market share could be said to have become "kind of the default" for anything (and certainly not when that requires generalising from n≅1).

The problem is that the number of browser engines is n=2.

Interestingly, Ladybird, which aims at being the n = 3, is also written in C++.
Post reply on HN