Mozilla’s Servo Lets Rust Shine
Mozilla’s next-generation server layout engine, Servo, is now nearly perfect in its rendering of GitHub.com, showing the optimizations with the use of the Rust programming language.
Mozilla Researcher Patrick Walton showcased Servo’s progress on Twitter with a screenshot on Monday.
This marks a significant milestone for Servo, as its progress continues with its ability to render large sites with modern markup. Servo is scheduled for a 2015 alpha release, with its third quarter 2015 roadmap pointing to add support for Rust components in Firefox Nightly, along with other small fixes, and continuing to work toward its alpha launch.
Mozilla aims to replace components using Gecko with those utilizing Rust to be shared with Servo. Rust is not only fast, but prevents nearly all segmentation faults (segfaults), with minimal runtime and threading without data racing. Rust utilizes multi-threading in such a way that rendering webpages is much faster while also being secure. Servo updating its Gecko components to utilize Rust will improve not only the developer experience working with the engine, but that of teams utilizing it within their pipeline.
Rust has gotten attention in the C++ community for its compilation tools. Rather than forcing users to debug segfaults, the Rust compiler will warn users that their code is not stable at compilation. Its package manager is set up in such a way that users can add libraries and dependencies with ease. Rust’s borrower checker and handling of memory safety mean that the language isn’t something one can pick up in an afternoon, ensuring that those truly wishing to learn the language write more efficient code as a result. Rust’s strict compiler ensures developers write clean, methodical code that if it passes compilation, one can be assured works as intended.
Servo testing will continue throughout 2015, with Mozilla addressing performance tests, compiling data, and working to address autolander cycle time. For developers that wish to use Servo in their own web rendering projects, Mozilla will offer a stable API/ABI with a C-based interface. Servo aims to also be compatible with the Chromium API. There are currently no plans to replace Gecko with Servo within Firefox and Thunderbird, though after seeing the Servo speed tests one can hope this is something that Mozilla will take into consideration. Currently, Mozilla is focusing on Servo in mobile and embedded environments, rather than desktop utilization. Samsung has contributed an ARM backend to Rust, with Servo gaining traction for Android-based web browsing as development continues.
Stack Management and the Future of Mobile Browsing
When addressing how to allocate memory to one’s stack, Rust allows for users to fine-tune how heap and stack allocations are handled. This is in stark contrast to Go, where its compiler utilizes escape analysis to determine if an element should go into the heap. Rust forces developers to actively think about stack allocation when programming, whereas other languages do this by default in ways which may be less efficient — allowing users to gloss over how their stack is managed, in some cases. Servo’s utilization of Rust is a significant step forward for the language, with the results clearly visible in how quickly Servo renders complex webpages.
Overall, Servo represents a unique opportunity for Rust to cement itself as the go-to language for mobile and embedded environment development. Mozilla has set a new standard for responsive, secure web browsing that takes advantage of the power of today’s smartphones. With more browsing being done via mobile on a daily basis, Servo has a guaranteed impact that will be seen not only be developers, but by those using their phones to connect with those that matter to them, without performance issues experienced by stock mobile browsers. More and more people are working from their mobile devices — demanding their phone replace their outdated technology — or their laptop if they travel. As we look to the future, Servo could shift the status quo toward Android, with its Rust backbone supporting the cornerstone of mobile development.
Feature image: “mozilla logo” by bkerensa is licensed under CC BY 2.0.