MozillaZine

Mozilla's Servo Engine Is Crazy Fast Compared To Gecko

Discussion about official Mozilla Firefox builds
The Timmy
 
Posts: 154
Joined: September 19th, 2010, 2:31 pm

Post Posted April 23rd, 2015, 11:56 pm

Followed the guide on how to build it, went smooth! Just tested it on my personal site for fun, and the only thing I noticed that it does wrong as far as rendering goes, it loads both the default, and alternate stylesheets and tries to apply both. No idea how to provide useful feedback for it though.

itisomegakai

User avatar
 
Posts: 358
Joined: February 13th, 2014, 11:52 am

Post Posted July 24th, 2015, 1:40 am

Servo developer tools overview

Servo is a new web browser engine. It is one of the largest Rust-based projects, but the total Rust code is still dwarfed by the size of the code provided in native C and C++ libraries. This post is an overview of how we have structured our development environment in order to integrate the Cargo build system, with its “many small and distributed dependencies” model with our needs to provide many additional features not often found in smaller Rust-only projects.
Mach

Mach is a python driver program that provides a frontend to Servo’s development environment that both reduces the number of steps required and integrates our various tools into a single frontend harness. Similar to its purpose in the Firefox build, we use it to centralize and simplify the number of commands that a developer has to perform.
mach bootstrap

The steps that mach will handle before issuing a normal cargo build command are: * Downloading the correct versions of the cargo and rustc tools. Servo uses many unstable features in Rust, most problematically those that change pretty frequently. We also test the edges of feature compatibility and so are the first ones to notice many changes that did not at first seem as if they would break anyone. Further, we build a custom version of the tools that additionally supports cross-compilation targeting Android (and ARM in the near future). A random local install of the Rust toolchain is pretty unlikely to work with Servo.

Updating git submodules. Some of Servo’s dependencies cannot be downloaded as Cargo dependencies because they need to be directly referenced in the build process, and Cargo adds a hash that makes it difficult to locate those files. For such code, we add them as submodules.

mach build & run

The build itself also verifies that the user has explicitly requested either a dev or release build — the Servo dev build is debuggable but quite slow, and it’s not clear which build should be the default.

Additionally, there’s the question of which cargo build to run. Servo has three different “toplevel” Cargo.toml files. * components/servo/Cargo.toml is used to build an executable binary named servo and is used on Linux and OSX. There are also horrible linker hacks in place that will cause an Android-targeted build to instead produce a file named servo that is actually an APK file that can be loaded onto Android devices. * ports/gonk/Cargo.toml produces a binary that can run on the Firefox OS Boot2Gecko mobile platform. * ports/cef/Cargo.toml produces a shared library that can be loaded within the Chromium Embedding Framework to provide a hostable web rendering engine.

The presence of these three different toplevel binaries and the curious directory structure means that mach also provides a run command that will execute the correct binary with any provided arguments.
mach test

Servo has several testing tools that can be executed via mach.

mach tidy will verify that there are no trivial syntactic errors in source files. It checks for valid license headers in each file, no tab characters, no trailing whitespaces, etc.

mach test-ref will run the Servo-specific reference tests. These tests render a pair of web pages that implement the same final layout using different CSS features to images. If the images are not pixel-identically, the test fails.

mach test-wpt runs the cross-browser W3C Web Platform Tests, which primarily test DOM features.

mach test-css runs the cross-browser CSS WG reference tests, which are a version of the reference tests that are intended to work across many browsers.

mach test-unit runs the Rust unit tests embedded in Servo crates. We do not have many of these, except for basic tests of per-crate functionality, as we rely on the WPT and CSS tests for most of our coverage. Philosophically, we prefer to write and upstream a cross-browser test where one does not exist instead of writing a Servo-specific test.

cargo

While the code that we have written for Servo is primarily in Rust, we estimate that at least 2/3 of the code that will run inside of Servo will be written in C/C++, even when we ship. From the SpiderMonkey JavaScript engine to the Skia and Azure/Moz2D graphics pipeline to WebRTC, media extensions, and proprietary video codecs, there is a huge portion of the browser that is integrated and wrapped into Servo, rather than rewritten. For each of these projects, we have a crate that has a build.rs file that performs the custom build steps to produce a static library and then produce a Rust rlib file to link into Servo.

The rest of Servo is a significant amount of code (~150k lines of Rust; ~250k if you include autogenerated DOM bindings), but follows the standard conventions of Cargo and Rust as far as producing crates. For the many crates within the Servo repo, we simply have a Cargo.toml file next to a lib.rs that defines the module structure. When we break them out into a separate GitHub repository, though, we follow the convention of a toplevel Cargo.toml file with a src directory that holds all of the Rust code.

Servo's dependency graph
Updating dependencies

Since there are three toplevel Cargo.toml files, there are correspondingly three Cargo.lock files. This configuration makes the already challenging updates of dependencies even moreso. We have added a command, mach update-cargo -p {package} --precise {version} to handle updates across all three of the lockfiles. While running this command without any arguments does attempt to upgrade all dependencies to the highest SemVer-compatible versions, in practice that operation is unlikely to work, due to a mixture of:

git-only dependencies, which do not have a version number

Dependencies with different version constraints on a common dependency, resulting in two copies of a library and conflicting types

Hidden Rust compiler version dependencies

Things we’d like to fix in the future

It would be great if there was a single Cargo.toml file and it was at the toplevel of the Servo repo. It’s confusing to people familiar with Rust projects, who go looking for a Cargo.toml file and can’t find them.

Cross-compilation to Android with linker hacks feels a bit awkward. We’d like to clean that up, remove the submodule that performs that linker hackery, and have a more clean/consistent feel to our cross-targeted builds.

Managing the dependencies — particularly if there is a cross-repo update like a Rust upgrade — is both a real pain and requires network access in order to clone the dependency that you would like to edit. The proposed cargo clone command would be a huge help here.


by The Servo TEAM

Virtual_ManPL

User avatar
 
Posts: 2008
Joined: July 24th, 2008, 5:52 am

Post Posted July 24th, 2015, 2:14 am


iwod
 
Posts: 1033
Joined: July 18th, 2003, 10:09 pm

Post Posted July 24th, 2015, 4:10 am

Servo is a new web browser engine. It is one of the largest Rust-based projects, but the total Rust code is still dwarfed by the size of the code provided in native C and C++ libraries.

I thought Servo is a total Rust project

harhar
 
Posts: 78
Joined: April 27th, 2012, 4:28 pm

Post Posted July 24th, 2015, 5:23 am

iwod wrote:Servo is a new web browser engine. It is one of the largest Rust-based projects, but the total Rust code is still dwarfed by the size of the code provided in native C and C++ libraries.

I thought Servo is a total Rust project

Yes, but if you take a step back and think of the whole code that's run on the machine to complete a certain task, there's always a lot of C and C++ code involved. You use libraries to talk to the OS, to deal with encryption, with connecting to stuff through the Internet, to render fonts, to render graphics. I think that's what he meant with this sentence you quoted.

The strengths of Rust are in helping the programmer introduce parallelism and concurrency and avoid memory problems that lead to memory leaks and security issues. This hopefully makes it a good choice to write the parts of the browser that tie all the code needed together.

Josa
 
Posts: 4154
Joined: July 28th, 2009, 4:52 pm

Post Posted July 24th, 2015, 6:46 am

Servo uses Spidermonkey, written in C++

Omega X

User avatar
 
Posts: 8130
Joined: October 18th, 2007, 2:38 pm
Location: A Parallel Dimension...

Post Posted July 24th, 2015, 3:04 pm

harhar wrote:
iwod wrote:Servo is a new web browser engine. It is one of the largest Rust-based projects, but the total Rust code is still dwarfed by the size of the code provided in native C and C++ libraries.

I thought Servo is a total Rust project

Yes, but if you take a step back and think of the whole code that's run on the machine to complete a certain task, there's always a lot of C and C++ code involved. You use libraries to talk to the OS, to deal with encryption, with connecting to stuff through the Internet, to render fonts, to render graphics. I think that's what he meant with this sentence you quoted.

The strengths of Rust are in helping the programmer introduce parallelism and concurrency and avoid memory problems that lead to memory leaks and security issues. This hopefully makes it a good choice to write the parts of the browser that tie all the code needed together.


^^^This.

Rewriting everything in Rust will take extreme amounts of time.
Latest: Firefox/70.0.1 *ESR/68.2.0 - Mobile/70.0 - Thunderbird/68.2.0
Nightly: Nightly/72.0a1 - Mobile/72.0a1 - Daily/72.0a1

Grantius

User avatar
 
Posts: 1545
Joined: June 28th, 2011, 4:14 pm

Post Posted July 27th, 2015, 5:10 am

I'm really looking forward to a public alpha of servo we can trial, to be honest.
Micro gaming box: AMD A10-7800 APU, 8gb RAM M350 ITX case (size of a book), Windows 10/Ubuntu
Tablet/Laptop: Asus Transformer T100, Intel Atom 2GB RAM, Windows 10 x86
Mobile:Xiaomi Redmi Note 3 Pro

The Timmy
 
Posts: 154
Joined: September 19th, 2010, 2:31 pm

Post Posted July 27th, 2015, 6:35 am

Grantius wrote:I'm really looking forward to a public alpha of servo we can trial, to be honest.

If you have a linux system it's pretty easy now. If not you can setup linux in a VM to try it(just make sure you don't have 3D acceleration enabled for the VM, at least with VirtualBox). Cloning the git repository takes a bit depending on your connection speed however.

Install required packages first:
Code: Select all
sudo apt-get install curl freeglut3-dev libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev msttcorefonts gperf g++ cmake python-virtualenv libssl-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev

Get servo shell from git
Code: Select all
git clone https://github.com/glennw/servo-shell

Get servo from git
Code: Select all
git clone https://github.com/servo/servo

Build servo
Code: Select all
cd servo
./mach build --release

Run servo using servo shell
Code: Select all
./mach run --release ../servo-shell/index.html -e

More information can be found on the servo git page. https://github.com/servo/servo

Can render many webpages decently.
Image

Grantius

User avatar
 
Posts: 1545
Joined: June 28th, 2011, 4:14 pm

Post Posted July 27th, 2015, 6:43 am

The Timmy wrote:
Grantius wrote:I'm really looking forward to a public alpha of servo we can trial, to be honest.

If you have a linux system it's pretty easy now. If not you can setup linux in a VM to try it(just make sure you don't have 3D acceleration enabled for the VM, at least with VirtualBox). Cloning the git repository takes a bit depending on your connection speed however.

Install required packages first:
Code: Select all
sudo apt-get install curl freeglut3-dev libfreetype6-dev libgl1-mesa-dri libglib2.0-dev xorg-dev msttcorefonts gperf g++ cmake python-virtualenv libssl-dev libbz2-dev libosmesa6-dev libxmu6 libxmu-dev

Get servo shell from git
Code: Select all
git clone https://github.com/glennw/servo-shell

Get servo from git
Code: Select all
git clone https://github.com/servo/servo

Build servo
Code: Select all
cd servo
./mach build --release

Run servo using servo shell
Code: Select all
./mach run --release ../servo-shell/index.html -e

More information can be found on the servo git page. https://github.com/servo/servo

Can render many webpages decently.
Image


Thanks mate, I use Ubuntu at home on my systems so I'll give this a go.

Cheers!
Micro gaming box: AMD A10-7800 APU, 8gb RAM M350 ITX case (size of a book), Windows 10/Ubuntu
Tablet/Laptop: Asus Transformer T100, Intel Atom 2GB RAM, Windows 10 x86
Mobile:Xiaomi Redmi Note 3 Pro

Grantius

User avatar
 
Posts: 1545
Joined: June 28th, 2011, 4:14 pm

Post Posted July 28th, 2015, 1:47 pm

So I compiled it. Wasn't expecting much, and Wikipedia seemed to browse around OK. No-where near a usable browser but for basically a test preview its pretty cool.

Image
Micro gaming box: AMD A10-7800 APU, 8gb RAM M350 ITX case (size of a book), Windows 10/Ubuntu
Tablet/Laptop: Asus Transformer T100, Intel Atom 2GB RAM, Windows 10 x86
Mobile:Xiaomi Redmi Note 3 Pro

itisomegakai

User avatar
 
Posts: 358
Joined: February 13th, 2014, 11:52 am

Post Posted January 26th, 2016, 9:26 am

After months of work by vlad and many others, Windows support landed! Thanks to everyone who contributed fixes, tests, reviews, and even encouragement (or impatience!) to help us make this happen.
Notable Additions

nikki added tests and support for checking the Fetch redirect count
glennw implemented horizontal scrolling with arrow keys
simon created a script that parses all of the CSS properties parsed by Servo
ms2ger removed the legacy reftest framework
fernando made crowbot able to rejoin IRC after it accidentally floods the channel
jack added testing the geckolib target to our CI
antrik fixed transfer corruption in ipc-channel on 32-bit
valentin added and simon extended IDNA support in rust-url, which is required for both web and Gecko compatibility


New Contributors

Chandler Abraham
Darin Minamoto
Josh Leverette
Joshua Holmer
Kishor Bhat
Lanza
Matthew Kuo
Oleksii Fedorov
St.Spyder
Vladimir Vukicevic
apopiak
askalski

http://blog.servo.org/images/upvote-windows.gif

Screencast of this post being upvoted on reddit… from Windows!

We had a meeting on some CI-related woes, documenting tags and mentoring, and dependencies for the style subsystem.


CI status
jack: Let's talk about what's going on and what we need to fix.
lars: Sometimes EC2 latent builders disappear, leaving build slaves in bad state. Other people issue force/clean commands which can put system into a bad state (making it do lots of things simultaneously), then I need to come in and reset everything. Possible solution: latent instances could make this go aware. Could also investigate why buildbot and ???? aren't working well together. Tempted to throw money at it.
jack: Reserved instances won't fix issue mentioned earlier of instances dying.
edunham: Buildbot configured to use spot instances will kill them when it's done. Focus of one MOSS grant is to improve EC2 compatibility, so I can make sure we understand what's going on. Long term solution, hopefully.
jack: With latent EC2 slave, if slave is idle more than N minutes, it spins it down. If there are none and buildbot job appears, all slaves are spun up. Problem only occurs if some already exist and it needs to spin up on that was earlier spun down. Also problem with no API errors if problem spinning up slave (like instance limit violation) and buildbot throws that information away and refuses to work after that. Spot instances won't fix this, and outbidding will cause them to be taken away from us. Mozilla already uses spot instances, so maybe that's better tested? Other problem is that during any build step, the slave can die. Not clear whether instance is going away or buildbot is crashing. Get "lost slave" message in build log.
brson: FYI, Rust has had increased number of EC2 slave exceptions in the past few weeks.
jack: Maybe there's high contention? Are you in the same availability zone - US West 2 for Servo?
edunham: Rust is in US West 1.
jack: More investigation needed. Are intermittents getting better?
larsberg: We disabled the worst ones.
jdm: Really bad. There seems to be a long tail of tests that may or may not be failing due to the same underlying problem, but it's hard to track that.
mbrubeck: I'm going to be debugging them starting this week.
jack: pcwalton is planning to redo the displaylist building this quarter, in support of webrender. Nice thing about this is that they're preserialized to save IPC channel stuff. So we can run WPT in debug mode, probably. Maybe that will fix some intermittents? Tell people not to use force?
jdm: Disable it?
edunham: Document when it's appropriate and when not.
larsberg: Only time should be used is when need to land a higher priority PR than anything else in the queue and should abort the current work.
jack: Is there a wiki page that documents how to interact with Homu?
edunham: https://github.com/servo/servo/wiki/Add ... po-to-Homu
jack: Let's document that incantation for moving a successful try to an r+
Manishearth: If we fork homu we won't need that. I have a PR to improve the situation. My only concern is that there used to be a test suite, and we don't have that. Can locally test, but it'd be nice to have automated stuff.
jack: Is Rust using upstream homu?
Manishearth: Only a very old version.
jack: We should only fork this once, so we have a Mozilla homu instead of rust/servo split.
Manishearth: We could ask them to upgrade.
jack: Who wants to document proper interactions? Is the plan to yell at people who use force, and otherwise do nothing until we get r+/try fixed?
[general agreement]
jack: What's the current build time?
larsberg: Not great - there are now lots more CSSWG tests, but we're over 30 minutes now. We need to be able to partition the tests across builders, which didn't work last time we tried it. We need jgraham, who comes back next week. There's good news - Travis is rolling out support for larger instance types, so soon we'll be able to have 15 concurrent builds and much larger instances. We could not use try and just have travis run all the tests on each PR as they come in.
jack: Do we have any problems with travis/homu combo?
Manishearth: It's all smooth.
jack: Seems like our issues are isolated to buildbot.
Last edited by trolly on January 26th, 2016, 10:12 am, edited 1 time in total.
Reason: Images too large. Breaks layout even on my FullHD screen.

koboltzz
 
Posts: 36
Joined: December 22nd, 2015, 3:17 am

Post Posted January 27th, 2016, 4:06 am

Very cool and amazing stuff :)
But.. how do I enable/test servo on windows now? Just using latest nightly?

Grantius

User avatar
 
Posts: 1545
Joined: June 28th, 2011, 4:14 pm

Post Posted January 27th, 2016, 4:38 am

You have to compile it from source.
Micro gaming box: AMD A10-7800 APU, 8gb RAM M350 ITX case (size of a book), Windows 10/Ubuntu
Tablet/Laptop: Asus Transformer T100, Intel Atom 2GB RAM, Windows 10 x86
Mobile:Xiaomi Redmi Note 3 Pro

koboltzz
 
Posts: 36
Joined: December 22nd, 2015, 3:17 am

Post Posted January 27th, 2016, 6:22 am

Thank you for the fast answer.
I am on it, at that moment it is compiling 'layers 0.2.0'

Just one last question, will I have a normal windows executable (among other files) which will run without msys OR it is still a very early command line run dependent on msys?

Return to Firefox Builds


Who is online

Users browsing this forum: No registered users and 5 guests