Live data from Hacker News

“The colored boxes indicate which CPU core performed layout for each node”

blog.servo.org

31–40 of 61 posts

Re: “The colored boxes indicate which CPU core performed layout for each node”

#31
post #19

If layout is going to be so parallelized does that mean we're going to need better asynchronous DOM APIs and possibly better Javascript threading support?

Ensuring that those APIs will exist and that other APIs don't block parallel layout is one of the goals of Servo, as a project. It's already informed several emerging standards.

> It's already informed several emerging standards.

Sounds interesting. Do you have more information on that? Any links?

Re: “The colored boxes indicate which CPU core performed layout for each node”

#32

Are multiple cores being used to draw a webpage? If so, do typical webpages need this level of performance for a satisfactory user experience?

  > If so, do typical webpages need this level of
  > performance for a satisfactory user experience?
Servo on desktop is certainly interesting, but a primary use case is mobile devices and other devices that have multiple CPU cores that aren't very powerful individually.

  > draw a webpage
Drawing a webpage on your screen entails a few different primary tasks.

Some things like alpha blending and animation can be offloaded to the GPU quite well and this is already being done extensively today on various mobile OSs.

Other things like layout, DOM manipulation, and scripting involve a lot of branching logic and need to be handled by the CPU. That's where Servo comes in - the goal is to better spread that stuff out across multiple CPU cores.

Re: “The colored boxes indicate which CPU core performed layout for each node”

#33

Earlier quoted context omitted.

> Are multiple cores being used to draw a webpage? Yes. There is coarse-grained parallelism (e.g. script, layout, painting can all happen simultaneously) and fine-grained parallelism (e.g. every render object is restyled and laid out concurrently). > If so, do typical webpages need this level of performance for a satisfactory user experience? It depends on the site, of course, but preliminary results show that multic…

It would be extremely interesting to see any numbers that compare single-core layout (in Servo) with multi-core layout (in Servo).

Here's a draft of an experience report regarding Servo that was submitted to this year's ICFP: http://kmcallister.github.io/papers/2015-servo-experience-re...

Table 1 seems to give some relevant data:

      Site | Gecko | Servo 1 thread | Servo 4 threads
    -------------------------------------------------
    Reddit |   250 |            100 |              55
       CNN |   105 |             50 |              35

  Table 1. Performance of Servo against Mozilla's Gecko
  rendering engine on the layout portion of some common
  sites. Times are in milliseconds, where lower numbers
  are better.
Given the promising numbers here, I feel like the following bold quote from a Servo-related job opening at Mozilla is relevant:

"Our goal is nothing less than building the fastest and most secure browser engine, and we aim to succeed by miles, not inches. We aim for double the performance of current engines, with no crashes."

http://careers.mozilla.org/en-US/position/ollA0fw0

Re: “The colored boxes indicate which CPU core performed layout for each node”

#34
post #29

speaking from a similar perspective here, I'm jealous of your long list of contributors

Piggybacking off of this, if anyone would like to try their hand at contributing to Servo I recommend checking out the "E-Easy" bugs on the issue tracker ( https://github.com/servo/servo/labels/E-easy ) and hitting up #servo on irc.mozilla.org ( http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23se... ). It's not often that you get to be a part of rewriting a browser engine from scratch. :) And you don't need…

I think this is a great advantage of Rust. Even with code review, you won't want to contribute your first C++ code to WebKit. But it's totally possible to contribute your first Rust code to Servo (I witnessed this multiple times), and damage you can cause is quite limited.

Re: “The colored boxes indicate which CPU core performed layout for each node”

#35
post #34
post #29

Earlier quoted context omitted.

Piggybacking off of this, if anyone would like to try their hand at contributing to Servo I recommend checking out the "E-Easy" bugs on the issue tracker ( https://github.com/servo/servo/labels/E-easy ) and hitting up #servo on irc.mozilla.org ( http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23se... ). It's not often that you get to be a part of rewriting a browser engine from scratch. :) And you don't need…

I think this is a great advantage of Rust. Even with code review, you won't want to contribute your first C++ code to WebKit. But it's totally possible to contribute your first Rust code to Servo (I witnessed this multiple times), and damage you can cause is quite limited.

WebKit actually has quite a lot of fairly nice, simple easy-to-read C++, especially around the DOM. Or at least did a few years ago, and I believe it's still mostly the case.

I remember asking for advice years ago where to cut my teeth on C++ and getting suggested WebKit by several — and people who weren't trying to lead me massively into a pit of doom. (Admittedly, I've still practically never contributed to WebKit, and I ended up doing my first larger bits of C++ on Presto. But hey, I've still read plenty of WebKit code over the years.)

Re: “The colored boxes indicate which CPU core performed layout for each node”

#36

Earlier quoted context omitted.

Yes multiple cores are being used. It's not that typical webpages need this level of performance, but by doing this you can actually save battery life and power usage on things like mobile devices and laptops. Since you can render the page 2-3x faster (numbers pulled out of donkey) you can use a burst of more cores at a lower speed to accomplish the same thing.

> Since you can render the page 2-3x faster (numbers pulled out of donkey) 2-3x faster seems about right for 4 cores: http://www.phoronix.com/scan.php?page=news_item&px=MTgzNDA I think that was on 4 ARM cores/threads, so the increase in performance may be even bigger for 4 cores/8 thread chips. From the PDF link it also seems that if the 4 cores work "at the same performance" level as 1 core, power consumption can dr…

Perfect. I thought that's what I remembered reading but couldn't even come close to finding it when I wrote that. That's the kind of research they've been intending to do with it for a while now and it's honestly huge enough that I won't be too surprised if Servo starts replacing Gecko on Firefox OS and the Firefox Mobile browsers. All it's going to take is to really get it working on 90% of websites and then I think it'll be a clear contender for replacing Gecko in a lot of places. I'd love to also see a JS engine in Rust but I know with a JIT and all you end up with none of the safety you get from Rust anyway. With the browser chrome being done in HTML with the mozbrowser extensions it looks like it might be possible to start doing a lot of the same things that XUL does in firefox which opens the door to a lot of stuff being ported to the new browser.

Re: “The colored boxes indicate which CPU core performed layout for each node”

#38
post #34

Earlier quoted context omitted.

I think this is a great advantage of Rust. Even with code review, you won't want to contribute your first C++ code to WebKit. But it's totally possible to contribute your first Rust code to Servo (I witnessed this multiple times), and damage you can cause is quite limited.

WebKit actually has quite a lot of fairly nice, simple easy-to-read C++, especially around the DOM. Or at least did a few years ago, and I believe it's still mostly the case. I remember asking for advice years ago where to cut my teeth on C++ and getting suggested WebKit by several — and people who weren't trying to lead me massively into a pit of doom. (Admittedly, I've still practically never contributed to WebKit,…

One nice—and, I think, underappreciated—thing about Servo layout is that the parallelism forces you to organize your algorithms cleanly. Unlike every other engine, render objects in Servo are not responsible for laying out their children recursively; the higher-level parallel traversal driver does that. That means that you must write your layout code in such a way that the right information is available at the time the traversal invokes your layout method. You are also limited in what you can access: your render object can't access your parent (because that would be racy), nor can it access the DOM (because we can run layout off the main thread). This requires a fair bit of up-front thought, but once that's finished it's easy to read the resulting code, because the layout code is grouped into specific functions ("assign-inline-sizes", "assign-block-sizes", and so forth) that do just one thing. This goes a long way toward making layout easier to understand, especially when it comes to complex situations like tables.

Re: “The colored boxes indicate which CPU core performed layout for each node”

#40
post #21

Are multiple cores being used to draw a webpage? If so, do typical webpages need this level of performance for a satisfactory user experience?

do typical webpages need this level of performance for a satisfactory user experience? It's needed because low-end phones have 8 slow cores instead of 2 fast cores.

Low end phones have 1 slow core, as far as I'm aware. I'm not aware of very many 8 core phones, let alone low end ones.
Post reply on HN