Live data from Hacker News

SerenityOS Browser now passes the Acid3 test

twitter.com

141–150 of 178 posts

Re: SerenityOS Browser now passes the Acid3 test

#141

Earlier quoted context omitted.

The old version ( http://acid3.acidtests.org/ ) will reach 97/100 on modern compliant browsers. There is a newer version ( https://wpt.live/acid/acid3/test.html ) which incorporates the changes made to the specs in the meantime, so modern browsers will reach 100/100 on this one again. The test was carried out against this version, as you can see in the address bar in the screenshot.

Your link also only gets 99/100 on modern browsers. Why? Well... // test 64: more attribute tests // attributes of the element var obj1 = document.createElement('object'); obj1.setAttribute('data', 'test.html'); // ... assert(obj1.data.match(/^http:/), "object.data isn't absolute"); See that "http" in test 64? Turns out you'll get a score of 100/100 if you use the http version of the URL instead of HTTPS.

Interesting, by forcing http I get 100/100 with chrome on windows but the animation is not smooth (there is a pause at 69/100) and it definitely does not match the reference image (there are no colored boxes at all).

Re: SerenityOS Browser now passes the Acid3 test

#143

Earlier quoted context omitted.

This, absolutely. Especially if it comes with a GUI in the same aesthetics as SerenityOS itself. The world needs less Chrome-clones and Google-backed browsers (which to a certain extent includes Firefox), and more independent ones. As someone who has also been attempting to write a browser (engine) in my spare time --- but these guys are far ahead of me --- this is great to see.

The problem is: who's gonna use it? Sure, it's good to have more options but, the deploy base of browsers like Chrome are massive and IE6 only lost its position by being careless and stop evolving (and lets not forget it took years), which is something that is not happening with Chrome. Just to make clear, this is not specifically directed to you or your project, which is a great thing to do independently of the outc…

The point is that a lot of sites out there don't need anything more than the web tech of 2 decades ago. With more people being aware of that and using browsers like this, the Google monopoly may weaken. I make it a point to complain whenever some site I need to use changes in the direction of Google's desires and becomes less browser-agnostic. It has had mixed results, but I suspect if a company is losing customers because its web devs are Google-loving trendchasers, they'll take notice.

Re: SerenityOS Browser now passes the Acid3 test

#144
post #80

Earlier quoted context omitted.

If I open this HN discussion page in the browser, it currently uses 44MB of private memory. We can definitely shave a couple of megabytes off of it with some effort, but supporting the contemporary web on a 4MB budget seems infeasible.

This really depends on design goals of course. Usually browsers are tend to sacrifice memory consumption (e.g. caching) for rendering speed. In Sciter, for example, this page on HN occupies less than megabyte in RAM. Sciter has quite different design goals than browsers.

Interesting! I didn't know about Sciter, but to me it sounds like Sciter kind of is a browser, heavyweight DOM and all: https://sciter.com/

Proprietary though, same as Presto, so I guess it's kind of a dead end.

Re: SerenityOS Browser now passes the Acid3 test

#145

Earlier quoted context omitted.

The problem is: who's gonna use it? Sure, it's good to have more options but, the deploy base of browsers like Chrome are massive and IE6 only lost its position by being careless and stop evolving (and lets not forget it took years), which is something that is not happening with Chrome. Just to make clear, this is not specifically directed to you or your project, which is a great thing to do independently of the outc…

The point is that a lot of sites out there don't need anything more than the web tech of 2 decades ago. With more people being aware of that and using browsers like this, the Google monopoly may weaken. I make it a point to complain whenever some site I need to use changes in the direction of Google's desires and becomes less browser-agnostic. It has had mixed results, but I suspect if a company is losing customers b…

> The point is that a lot of sites out there don't need anything more than the web tech of 2 decades ago. With more people being aware of that and using browsers like this, the Google monopoly may weaken.

I always thought this was a way to get out of this, that agrees with your vision. First you'll need a powerful force to take back control on defining web standards.

This new web standard would be a very simplistic one, making possible for two or three (or even one) people to create new browsers on top of it.

But this movement would need to be so strong, that it would be possible to make a dent and start to lead a new way. And this is the one of the most hardest part. People on this movement would need to be prepared to fight for at least 10 years without loosing its faith until the killer app of this movement should be able to be at a market share bigger than Safari and taking over the Firefox position.

This movement could use the hype akin to Rust folks to navigate the harder first years. Its a possibility but it's hard to become possible. Another thing to notice is that the Firefox position is getting weaker, but the most probable candidate to take over is the chrome-based Brave.

So unless a "black-swan" event happen it's hard to see a big change into this in the coming years. BTW it's even more likely that the browser standards get stronger by completely taking over the mobile applications..

Re: SerenityOS Browser now passes the Acid3 test

#146
post #97

Earlier quoted context omitted.

Obviously I don't know anything about the Serenity browser, but in the Gecko/WebKit/Blink cases it's mostly startup overhead. A page with a single word on it ends up being more than 44MB. The DOM is a braindead abortion that should never have been standardized. There's no plausible way to implement it with reasonable efficiency.

That last part sounds interesting. Can you elaborate?

DOM nodes are mutable and have parent pointers, so there's no way to share structure between duplicated parts of the element tree; JS might mutate them to no longer be duplicates. NodeLists like the .childNodes property (but not the results of, say, .querySelectorAll) are required to be "live", magically updating when you change the document; this code produces 1 even though there's no explicit mutation of c:

    let d = document, b = d.body, c = b.childNodes, n = c.length; b.appendChild(d.createElement('div')); console.log(c.length - n);
So to a significant extent we're stuck for eternity with the design tradeoffs and even bugs of Internet Explorer 3, because bugs like this one are exposed through this interface and standardized by the W3C.

If you weren't constrained by W3C DOM compatibility and wanted to trade off lower memory usage for slower small mutations, one extreme strategy would be to maintain chunks of the page tree as Polish-notation bytecode instead of materialized nodes full of pointers; then this discussion-thread page, with its 60 K of text and 3000 HTML elements (expanded to 4758 since my earlier comment, but let's disregard that), might require 80K of RAM instead of 512K or more. So for example

          
might become

    { tr                        # 2 bytes
    attr class "athing comtr"   # 3 bytes
    attr id "30861517"          # 4 bytes, plus 16 or so for the string table entry
    { td                        # 2 bytes
    }                           # 1 byte
    { table
    attr border "0"
    text "  "                   # 4 bytes, text is inline with prefixed length
    { tr
    text "    "                 # 6 bytes
    { td
    attr class "ind"
    attr indent "3"
    ...
    }
    }
    }
    }
assuming the tag names and attribute names and values are indices into a "symbol table" in a UTF-8-style variable-length encoding, an encoding which is also used for byte string lengths. This encoding reduces the original 97 bytes of this fragment (plus its end tags) to about 57 bytes.

You wouldn't want to store the entire page as a single long string of such bytecode, because that would make tree traversals unreasonably slow. You'd limit the bytecode blocks to 32–256 operations and then build a more conventional node tree or B-tree to knit those leaves together into a whole document. Mutations to the page inside such a leaf block would require rebuilding the block.

In 02022 slower small DOM mutations seems like a very reasonable idea given the prevalence of things like React which tend to rebuild large parts of the page from scratch anyway.

Of course even more extreme points on the time/space tradeoff curve do exist; you could reparse the HTML source from an LZMA-compressed representation on every redraw (compression ratio 8.3 on the current 304kB version of this page, so the 179K incarnation we've been using as an example would be about 22K, and a little HTML minification might squeeze that down further). But my intuition is that even with current CPUs you wouldn't get reasonable performance that way.

Why "512K or more"? The DOM more or less requires pointers to parent, nextSibling, and firstChild, which we can suppose are 64 bits, plus a 64-bit field for node type and padding, which gives us 32 bytes per node; there are about 0.85 text nodes per element, so we have about 5400 nodes for 3000 HTML elements, giving 172.8 kB, and adding in the size of the text gets us past 256KiB. And then we need some space for attributes, cached layout, cached styles, etc. So 512K is easy and the reality is more like 1–4 MiB. For a page that Links renders into 60K of UTF-8 text!

For more markup-heavy pages, which is almost all of them, the ratio is larger.

An intermediate tradeoff would be something like Fredrik Lundh's ElementTree interface for Python, but with iterators over the tree represented as variable-size paths down from the root, permitting hash consing to automatically share structure between all the instances of , "reply", " | ", "[–]", and akling. Moreover the ElementTree design doesn't require type-tag fields (though CPython of course does spend memory on them).

In ElementTree each element has string attributes .tag, .text (the leading CDATA text inside the element, possibly None in the Python implementation, which I see as a design error), and .tail (any CDATA text that follows the element, also possibly None in the Python implementation), a list of zero or more child elements, and a possibly-empty string-to-string map (dict) of attributes. There are no parent pointers, though the mutability of ElementTree itself means you still can't share child subtrees that happen to be equal. Child elements are always elements; text and tail are always strings (except where null).

Consider a FORTRAN-style linked-list representation of an ElementTree. For a page tree of up to 65535 elements, 65535 text nodes, and 65535 name-value pairs, you could represent these as arrays of 16-bit integers, assigning each element a 16-bit element ID used to index parallel arrays of 16-bit ints named TAG, TEXT, TAIL, KID, NEXT, and ATTR. KID and NEXT contain element IDs which are -1 to indicate no children or no following siblings, respectively. ATTR may contain -1 (no attributes) or index three parallel arrays named NAME, VALUE, and MORE, the third of which contains -1 or another index into these three tables. TAG, TEXT, TAIL, NAME, and VALUE all index a string table, which is an array of 32-bit ints named START. START indexes an array of bytes named CHARS, and there's an allocation pointer FREE which points to the lowest unused index in START. The bytes of string N start at CHARS[START[N]] and continue to CHARS[START[N+1]]; the first unused byte in CHARS is at CHARS[START[FREE]]. Optionally you can build a hash table over the entries in START to allow the reuse of duplicate strings, since you can't efficiently insert or delete characters within an existing string anyway.

This works out to 12 bytes per element, 6 bytes per attribute, and 4 bytes per string, and it allows mutation just as efficiently as the Python version (i.e., you have to make a copy of any string you want to modify, but you can insert and delete elements in constant time, or graft them onto a different part of the element tree). And it's simpler, not more complex, to iterate over or evaluate CSS-style selector queries on, than the W3C DOM.

With this representation, if you had 3000 elements, 3000 attributes, and 2500 strings totaling 60 kB of text, you'd need 124 kB of memory, plus allocation overhead. And if you're in a reasonably dynamic language you can replace these arrays of 16-bit integers with arrays of 32-bit integers whenever one of these collections goes over 65536 elements. (In Numpy this is quite transparent once it is done.)

Re: SerenityOS Browser now passes the Acid3 test

#147
post #69

Earlier quoted context omitted.

What's a rough minimum for a page with some text on it? Are we talking about 64MiB like Chromium, WebKit, or Gecko, or more like 16KiB, 256KiB, 4MiB, or 1 GiB? I think of memory usage as being more about correctness than performance, though I know that isn't how most people see it. Trying to run a 512MiB process on a 64MiB computer, or a 512GiB process on a 64GiB computer, is just never going to run at a usable speed…

The lowest bound would be the size of the texture the page is rendered into, no ? If you're on a 4k screen an uncompressed rgba pixmap is already 31MB... And that's really just the raw pixel storage which needs to be associated with your process

You don't have to render the whole page to a pixmap at once; it's very reasonable for a display-list representation of the page using a font atlas to be a tiny fraction of that size, maybe 8 bytes per character, and a GPU shader can render the RGBA pixmap from a spatially partitioned display list on demand. 2144 characters of text on my 1920×1080 display extrapolates to 17152 characters on a 4K display, which would be 140K of display-list data. 0.14 MB is a lot less than 31MB.

(You need additional display-list items for things like the #ff6600 bar at the top and the #f6f6ef background, but those occupy insignificant space even compared to the 2144 characters. The Yahoo/Y-combinator logo and the arrows also add a little bit.)

Of course #notallpages are mostly text, and many of them will require intermediate storage for large photos, es, or screenshots of faked Tweets.

If you're on a smaller computer you might render one scan line at a time from a display list consisting of strings rather than individual characters. Those 2144 characters are in 29 lines, so the display list might be under 3K, and a 400-pixel 1-bit-per-pixel scan line is 50 bytes. If you're generating PAL this way you have 64 μs to render each line, which is about 1000–6000 instructions on current microcontrollers, and you can maybe manage 450 color pixels, another 2K or so of raw pixel storage.

Re: SerenityOS Browser now passes the Acid3 test

#148
post #60

That's wonderful! How much RAM does it need? My biggest complaint about modern browsers is that I can't load a web page in less than 64 MiB, which is more than my entire computer had when I was running Netscape 3. The browsers are better now, but not in ways that necessarily use more memory.

Your screen likely has gotten better in ways that necessarily use more memory: more pixels, more bit depth means larger pictures, larger font caches (because of larger characters and anti-aliasing), etc. The pages you look at also have gotten ‘better’ in ways that necessarily use more memory. I don’t think you regularly loaded megabytes of JavaScript. Finally, your browser usage likely has gotten ‘better’ in ways tha…

While there is something to this, and antialiased fonts and CJKV rendering are particularly beneficial, I mostly don't agree about necessarily using more memory (see https://news.ycombinator.com/item?id=30872388). We're talking about orders of magnitude more memory than the screen contents.

As for JS, on most pages the only benefit of those megabytes of JavaScript is that I need to use uBlock Origin and/or Reader Mode to read what I'm actually interested in, the page jumps around at random while I'm trying to read it, Twitter tries to extort me into logging in, DoubleClick and reCaptcha can fingerprint my GPU, etc. Also, a megabyte of minified JS might reasonably compile down into a megabyte of bytecode or 4 MiB of native code, not 64 MiB or 128 MiB. JS's execution model is kind of inherently memory-hungry, though.

64 MiB is for one tab.

Re: SerenityOS Browser now passes the Acid3 test

#149

I don't follow web standards closely, but I'm curious if this comment is still true (or was ever true): "For people who don't follow modern web standards, a modern web browser getting 100/100 is actually failing tests. You should get 97/100, failing tests 23, 25, and 35." https://news.ycombinator.com/item?id=18941348

That's pretty dumb grading. Why not flip the sense of the assert for those three tests?

It's useful for statements like "Firefox 2.0 got 82/100 on the Acid3 test" to have truth-values that don't change over time. The Acid3 test is an important part of the history of the Web, and rewriting history is repugnant.

Re: SerenityOS Browser now passes the Acid3 test

#150
post #121

The test should no longer be used: > Acid3, in particular, contains some controversial tests and no longer reflects the consensus of the Web standards it purports to test, especially when it comes to issues affecting mobile browsers. The tests remain available for historical purposes and for use by browser vendors. It would be inappropriate, however, to use them as part of a certification process, especially for mobi…

I don't think the quote you quoted justifies your conclusion that Acid3 should no longer be used for anything. There's a lot of the web for which Acid3 levels of standards compliance is adequate for readability, and Acid3 enables a very quick feedback loop during development.
Post reply on HN