servo
Servo aims to empower developers with a lightweight, high-performance alternative for embedding web technologies in applications.
Top Related Projects
SUPERSEDED by https://github.com/mozilla-firefox/firefox. Read-only Git mirror of the Mercurial gecko repositories at https://hg.mozilla.org
Home of the WebKit project, the browser engine used by Safari, Mail, App Store and many other applications on macOS, iOS and Linux.
The official GitHub mirror of the Chromium source
ChakraCore is an open source Javascript engine with a C API.
Node.js JavaScript runtime ✨🐢🚀✨
:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Quick Overview
Servo is an experimental web browser engine written in Rust. It's designed to be a high-performance, parallel rendering engine that takes advantage of modern hardware capabilities. Servo is not a complete browser but rather a platform for experimenting with new browser architectures and technologies.
Pros
- Written in Rust, providing memory safety and concurrency without data races
- Highly modular architecture, allowing for easy experimentation and integration of new features
- Designed for parallel processing, potentially offering better performance on multi-core systems
- Open-source project with active community involvement
Cons
- Not a complete browser, lacking many features found in production browsers
- Still experimental, with potential instability and incomplete implementations
- Limited compatibility with some web standards compared to mature browsers
- Smaller ecosystem and developer community compared to established browser engines
Getting Started
To build and run Servo:
- Install Rust and other dependencies (varies by OS)
- Clone the repository:
git clone https://github.com/servo/servo.git cd servo
- Build Servo:
./mach build --dev
- Run Servo:
./mach run --dev https://example.com
For more detailed instructions, refer to the CONTRIBUTING.md file in the repository.
Competitor Comparisons
SUPERSEDED by https://github.com/mozilla-firefox/firefox. Read-only Git mirror of the Mercurial gecko repositories at https://hg.mozilla.org
Pros of Gecko-dev
- Mature and battle-tested codebase with extensive browser compatibility
- Larger community and more extensive documentation
- Supports a wider range of platforms and devices
Cons of Gecko-dev
- Heavier codebase with more legacy code to maintain
- Slower development cycle due to its size and complexity
- Less focus on modern, parallel processing techniques
Code Comparison
Servo (Rust):
fn layout_block(
layout_context: &mut LayoutContext,
tree: &mut FlowTree,
node: &mut LayoutNode,
) -> LayoutResult {
// Layout implementation
}
Gecko-dev (C++):
nsresult
nsBlockFrame::Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus)
{
// Reflow implementation
}
The code snippets show different approaches to layout handling. Servo uses Rust with a more modern, functional style, while Gecko-dev uses C++ with a more traditional object-oriented approach. Servo's implementation appears more concise, reflecting its focus on parallelism and modern language features. Gecko-dev's code shows its maturity and compatibility with older systems, but may be more complex to maintain and optimize.
Home of the WebKit project, the browser engine used by Safari, Mail, App Store and many other applications on macOS, iOS and Linux.
Pros of WebKit
- Mature and widely adopted, powering Safari and other browsers
- Extensive documentation and community support
- Proven track record in production environments
Cons of WebKit
- Larger codebase, potentially harder to contribute to or modify
- Slower development cycle due to its size and complexity
- Less focus on modern, parallel processing techniques
Code Comparison
WebKit (Objective-C++):
RefPtr<Frame> Frame::create(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* client)
{
RefPtr<Frame> frame = adoptRef(new Frame(page, ownerElement, client));
frame->init();
return frame;
}
Servo (Rust):
impl Frame {
pub fn new(window: &Window) -> Frame {
Frame {
window: window.clone(),
document: DomRoot::new(Document::new(window)),
// ... other fields ...
}
}
}
The WebKit code uses Objective-C++ with reference counting, while Servo employs Rust's ownership model. Servo's implementation is more concise and leverages Rust's safety features. WebKit's approach reflects its longer history and compatibility requirements across different platforms.
The official GitHub mirror of the Chromium source
Pros of Chromium
- Mature and widely adopted browser engine with extensive web compatibility
- Large community and corporate backing, leading to frequent updates and support
- Comprehensive feature set, including advanced web APIs and performance optimizations
Cons of Chromium
- Larger codebase and more complex architecture, potentially harder to contribute to
- Higher resource usage and memory footprint
- Less focus on modern, parallel processing techniques compared to Servo
Code Comparison
Chromium (C++):
void RenderFrameHostImpl::DidCommitNavigation(
NavigationRequest* navigation_request,
const mojom::DidCommitProvisionalLoadParams& params,
mojom::DidCommitProvisionalLoadInterfaceParamsPtr interface_params) {
// Navigation logic implementation
}
Servo (Rust):
impl Frame {
pub fn load_url(&mut self, url: ServoUrl) {
let pipeline_id = self.pipeline_id;
self.constellation_chan
.send(ConstellationMsg::NavigationRequest(pipeline_id, url));
}
}
The code snippets demonstrate differences in language (C++ vs. Rust) and architecture. Chromium's approach is more complex, while Servo's implementation is more concise and leverages Rust's safety features.
ChakraCore is an open source Javascript engine with a C API.
Pros of ChakraCore
- More mature and production-ready, used in Microsoft Edge
- Better performance for JavaScript execution
- Wider compatibility with existing web standards
Cons of ChakraCore
- Less focus on next-generation web technologies
- Smaller community and contributor base
- More limited in scope, primarily focused on JavaScript engine
Code Comparison
ChakraCore (JavaScript execution):
JsValueRef JSHost::RunScript(const wchar_t* script, const wchar_t* sourceUrl)
{
JsValueRef result;
JsRunScript(script, currentSourceContext++, sourceUrl, &result);
return result;
}
Servo (Rust-based rendering):
fn layout(&mut self, tree: &mut LayoutTree) -> LayoutResult {
let viewport = self.viewport.size.to_f32();
let style = self.style.get();
tree.layout(viewport, style)
}
Summary
ChakraCore is a more established JavaScript engine with better performance and compatibility, while Servo is an experimental browser engine focusing on next-generation web technologies and parallelism. ChakraCore is primarily C++-based and centered on JavaScript execution, whereas Servo is written in Rust and aims to rethink browser architecture for modern hardware.
Node.js JavaScript runtime ✨🐢🚀✨
Pros of Node.js
- Larger community and ecosystem, with more packages and resources available
- More mature and stable, with widespread production use
- Better performance for I/O-bound tasks and asynchronous operations
Cons of Node.js
- Less suitable for CPU-intensive tasks compared to Servo's Rust-based architecture
- Larger memory footprint and potentially slower startup time
- Limited built-in parallelism compared to Servo's multi-threaded design
Code Comparison
Node.js (JavaScript):
const http = require('http');
const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Hello, World!');
});
server.listen(8080);
Servo (Rust):
use std::net::{TcpListener, TcpStream};
use std::io::{Write, Read};
fn handle_client(mut stream: TcpStream) {
let response = "HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\nHello, World!";
stream.write(response.as_bytes()).unwrap();
}
fn main() {
let listener = TcpListener::bind("127.0.0.1:8080").unwrap();
for stream in listener.incoming() {
handle_client(stream.unwrap());
}
}
:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Pros of Electron
- More mature and widely adopted in production applications
- Extensive documentation and large community support
- Cross-platform development with familiar web technologies
Cons of Electron
- Higher memory usage and larger application size
- Less performant compared to native applications
- Security concerns due to Chromium's attack surface
Code Comparison
Electron (JavaScript):
const { app, BrowserWindow } = require('electron')
function createWindow () {
const win = new BrowserWindow({ width: 800, height: 600 })
win.loadFile('index.html')
}
app.whenReady().then(createWindow)
Servo (Rust):
use servo::*;
fn main() {
let mut opts = opts::default();
opts.url = Some("https://example.com".to_string());
servo::run_servo(opts);
}
Electron uses JavaScript and web technologies for building desktop applications, while Servo is written in Rust and focuses on building a new browser engine. Electron's code is more familiar to web developers, whereas Servo's code requires knowledge of Rust and lower-level browser concepts.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
The Servo Parallel Browser Engine Project
Servo is a prototype web browser engine written in the Rust language. It is currently developed on 64-bit macOS, 64-bit Linux, 64-bit Windows, 64-bit OpenHarmony, and Android.
Servo welcomes contribution from everyone. Check out:
- The Servo Book for documentation
- servo.org for news and guides
Coordination of Servo development happens:
- Here in the Github Issues
- On the Servo Zulip
- In video calls advertised in the Servo Project repo.
Getting started
For more detailed build instructions, see the Servo book under Setting up your environment, Building Servo, Building for Android and Building for OpenHarmony.
macOS
- Download and install Xcode and
brew
. - Install
uv
:curl -LsSf https://astral.sh/uv/install.sh | sh
- Install
rustup
:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Restart your shell to make sure
cargo
is available - Install the other dependencies:
./mach bootstrap
- Build servoshell:
./mach build
Linux
- Install
curl
:- Arch:
sudo pacman -S --needed curl
- Debian, Ubuntu:
sudo apt install curl
- Fedora:
sudo dnf install curl
- Gentoo:
sudo emerge net-misc/curl
- Arch:
- Install
uv
:curl -LsSf https://astral.sh/uv/install.sh | sh
- Install
rustup
:curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Restart your shell to make sure
cargo
is available - Install the other dependencies:
./mach bootstrap
- Build servoshell:
./mach build
Windows
- Download
uv
,choco
, andrustup
- Be sure to select Quick install via the Visual Studio Community installer
- In the Visual Studio Installer, ensure the following components are installed:
- Windows 10 SDK (10.0.19041.0) (
Microsoft.VisualStudio.Component.Windows10SDK.19041
) - MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest) (
Microsoft.VisualStudio.Component.VC.Tools.x86.x64
) - C++ ATL for latest v143 build tools (x86 & x64) (
Microsoft.VisualStudio.Component.VC.ATL
) - C++ MFC for latest v143 build tools (x86 & x64) (
Microsoft.VisualStudio.Component.VC.ATLMFC
)
- Windows 10 SDK (10.0.19041.0) (
- Restart your shell to make sure
cargo
is available - Install the other dependencies:
.\mach bootstrap
- Build servoshell:
.\mach build
Android
- Ensure that the following environment variables are set:
ANDROID_SDK_ROOT
ANDROID_NDK_ROOT
:$ANDROID_SDK_ROOT/ndk/26.2.11394342/
ANDROID_SDK_ROOT
can be any directory (such as~/android-sdk
). All of the Android build dependencies will be installed there.
- Install the latest version of the Android command-line
tools to
$ANDROID_SDK_ROOT/cmdline-tools/latest
. - Run the following command to install the necessary components:
sudo $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --install \ "build-tools;34.0.0" \ "emulator" \ "ndk;26.2.11394342" \ "platform-tools" \ "platforms;android-33" \ "system-images;android-33;google_apis;x86_64"
- Follow the instructions above for the platform you are building on
OpenHarmony
- Follow the instructions above for the platform you are building on to prepare the environment.
- Depending on the target distribution (e.g.
HarmonyOS NEXT
vs pureOpenHarmony
) the build configuration will differ slightly. - Ensure that the following environment variables are set
DEVECO_SDK_HOME
(Required when targetingHarmonyOS NEXT
)OHOS_BASE_SDK_HOME
(Required when targetingOpenHarmony
)OHOS_SDK_NATIVE
(e.g.${DEVECO_SDK_HOME}/default/openharmony/native
or${OHOS_BASE_SDK_HOME}/${API_VERSION}/native
)SERVO_OHOS_SIGNING_CONFIG
: Path to json file containing a valid signing configuration for the demo app.
- Review the detailed instructions at Building for OpenHarmony.
- The target distribution can be modified by passing
--flavor=<default|harmonyos>
to `mach <build|package|install>.
Top Related Projects
SUPERSEDED by https://github.com/mozilla-firefox/firefox. Read-only Git mirror of the Mercurial gecko repositories at https://hg.mozilla.org
Home of the WebKit project, the browser engine used by Safari, Mail, App Store and many other applications on macOS, iOS and Linux.
The official GitHub mirror of the Chromium source
ChakraCore is an open source Javascript engine with a C API.
Node.js JavaScript runtime ✨🐢🚀✨
:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot