Mozilla's Servo Engine Now Capable of Rendering GitHub
phoronix.com
phoronix.com
I've been working on knocking down layout bugs that affect the most popular sites lately. Please feel free to try it out and file GitHub issues, especially if you can minimize test cases! You're definitely likely to see various degrees of brokenness on most sites, but the core CSS 2.1/CSS3 layout is pretty solid at this point; there's just a long tail of bugs and corner cases we've got to nail down. This is where finding and isolating the bugs that break the major Web sites is important!
Why not, I'll start doing this as it can't do any harm and create some test cases should I find some weirdness.
It's really easy to build a copy of servo after all:
https://github.com/servo/servo
The instructions there generally just work.For example I am willing to develop in your browser if it meant I wouldn't broke some rules and the browser would care about that. Of course html validators exist and browsers display invalid css in their inspectors but I am asking for something like that would expect valid code. throw an error in my face if I didn't close a html tag or used an invalid css value, at any point.
Like if a javascript code resulted in my page getting invalid layout then browser could yell at me that causes an invalid layout. Maybe even a small performance improvement if my code conformed to every layout rule.
I just wanted to play with it anyway.
In short, there's a lot to make you want to move over. Still, I a) have a ~90K LOC code base in C++/Obj-C that I'm not going to abandon any time soon, and b) after having gotten burned (in Haskell) by the "more purity or strictness (in the conventional, not evaluation, sense) is always better" argument, I'm waiting to be convinced that having a more picky compiler actually helps rather than getting in the way. As mentioned above, projects like this certainly make one more confident that it does help.
See here for more:
* https://developer.mozilla.org/en-US/Firefox/Building_Firefox_with_Rust_code
* https://bugzilla.mozilla.org/show_bug.cgi?id=1175322
* https://bugzilla.mozilla.org/show_bug.cgi?id=1151899
(and Firefox is mostly C++, not C)Specific problems were extending a program to do "just one more thing", as is commonly the case for more "scripty" tasks. This often caused severe refactoring, as what was suddenly a simple function or IO/ST monad now had to include another monad and it all would become a bit of a mess. In general I find combining monads in Haskell pretty unpleasant, especially when you consider that this kind of stuff is so trivial in other languages that you don't even think about it. To put it shortly, I would spend too many brain cycles wrestling with Monads and strictness and Haskelly concepts, and too little on my actual problem.
But hey, that was some time ago and YMMV.
The productivity curve for Haskell is exactly the opposite of something like Python. You spend a lot of time at the beginning writing all your fancy types, monads, etc. Then later when you have thousands of lines of code you can make non-trivial changes with the ease with which you could write a tiny one-off Python script.
It's a fantastic exercise to get to that point in Haskell, and the skills carry over in surprising ways to conventional languages too, so I unequivocally recommend it to anyone with at least, oh, say, 4 years of experience in "conventional" programming, to get you to the next level of programming skill. But make no mistake, it is quite the learning curve. I think this is a positive thing, though... the reason why it is such a learning curve is precisely that you are learning, in exactly the way you really aren't learning anything when you pick up your fifth object-oriented imperative language.
Then you actually have to use it for a while.
Improvements which would make me really happy:
* Faster builds. This is still a pain point.
* "Non-lexical borrows" [1]
* Trapped under ICE [2]
I know that all of the above are being actively worked on, so I'm waiting patiently. [3]
[1] Borrows are currently tied to scopes (blocks, etc). This makes certain safe borrowing patterns illegal, requiring slightly-to-highly awkward workarounds.
[2] The compiler crashes too often (ICE). I was recently stuck with a non-compiling code base and facing the prospect of systematically commenting out code to find the offending piece. Fortunately, this one was fixed quickly. There are many others remaining, though. (It is getting better as Rust gets more use.)
[3] This is a lie. Patience is rarely one of my virtues.
This is a pain point for us, too, on Servo. There's fantastic active work going on for incremental builds, which will solve our most pressing needs (long turn-around on debug changes).
Also, if you're on linux, make sure you're using gold instead of system ld. That change made a huge difference for Servo.
[2] --- let's hope this improves :)
I went all-in for side projects like you (this is how I typically learn a language), but after two months or so, I was spending 30-60 minutes a day trying to figure out the cause of compiler crashes, and then tweak my code so it didn't trigger them.
I've heard the ICEs have gotten much better in 1.2 (I was working in 1.0), but I haven't picked it up again.
@seertaak, can you quickly explain how the strictness became a problem?
Here's the current page: http://i.imgur.com/NmRNaRz.png
If you want to poke around more, servo shell[1] lets you switch starting pages without having to re-run from the command line.
[0] https://github.com/servo/servo [1] https://github.com/glennw/servo-shell
We have a bunch of easy issues (https://github.com/servo/servo/labels/E-easy) and are willing to mentor people on them.
Github - https://twitter.com/pcwalton/status/633411771617832961
Ars - https://twitter.com/pcwalton/status/631961638304804864
But basically printing APIs are not multithreaded across all OS's
When printing though, you don’t know where to start page 10 until you’ve done the layout of earlier pages. There may still be some parallelism opportunity, but less than on screen.
Apple and Google could very well have secret projects going on for such a thing though.
That's pretty oversimplified. For lots of workloads—e.g. interacting with widgets on the page, composing emails/etc, scrolling, opening pop-out menus, interacting with Google Maps—the rendering (broadly speaking) is the bottleneck.
In fact, I'm of the opinion that improving layout and graphics performance is the single biggest thing we can do to make Web apps not feel slow compared to their native counterparts. People still (often quite rightly) feel that the Web is slower than native (however "native" is defined). The difference is unlikely to be network-related, and it's unlikely to be JavaScript either for most apps—JS performance may not be at C++-level yet (though asm.js will get there in time), but it's certainly on par with Objective-C and Java/Dalvik. The problem is mostly styling, layout, and graphics in my view: how to get from the DOM to rendered pixels as quickly as possible. Those are, not coincidentally, what Servo has focused on.
The way to solve this is NOT to make Javascript faster. The way to solve this is also NOT to force websites to run few numher of Javascripts at the same time.
The way to solve this is to virtualized all the tabs. In other word, tabs that are not visible should be unloaded (allow the user to right click a tab and "Keep This Tab Loaded"). This saves on CPU usage and RAM usages.
In summary, rendinger performaces is in the milliseconds, compare to running 10,000 Javascripts, which is in the minutes.
Multicore devices shut down cores to save energy. How would multithreaded rendering save energy?
[0] http://blogs.s-osg.org/servo-adapting-c-to-work-on-the-web/
The vast majority of them.
(I haven't done the exact analysis, but I have performed similar ones and the fact that memory safety issues dominated was clear. Note also that I am not claiming that solving memory safety issues is a panacea. "Merely" that we're defending against the vast majority of critical security vulnerabilities.)
Following http://twitter.com/ServoDev can keep you up to date for now.
I'd love to see more posts soon, if you or someone else ever gets the time*!
I'm amazed to see how much average Joe users have Chrome installed with no help from anyone.
Edit: Want to add that I wasn't taking a stab a Servo, which is a truly awesome project on its own no matter what's going with Mozilla.
Entering a mature market with a new product often winds up a fruitless effort. I think they'll have a better shot with new categories like Smart Watches, Smart Mini MP3 Players and those Smart Flip Phones/Sliders. Android is having major issues entering those categories for quite some time so that leaves a good opening for competition.
Another thing they can do is to build their own phone. Make it the best phone that they possibly can and support it for 5-10 years. With the only revisions making it smaller and cheaper but otherwise the same (ie. same architecture but miniaturized). Even if during those 5-10 years it's not seen uptake Mozilla will have built up a unmatched reputation for supporting their devices. So when the successor is announced...