@pnkfelix
), Mozilla ResearchSlides: http://bit.ly/2c0zILe
(space: next slide; shiftspace: previous slide; esc: overview; arrows navigate)
Rust: new systems programming language
Mozilla: building new high-perf. browser technology atop Rust
Servo: Browser research platform
Browser | Frames/Second |
---|---|
Chrome | 15 fps |
Firefox | 9 fps |
Safari | 5 fps |
Servo WebRender (web content atop GPU) | 60 fps |
Systems Programmers make:
Browsers
Operating Systems
Game Engines
Mobile Apps
Willing to invest great effort to optimize resource usage (e.g. low memory overhead), and runtime performance.
So many to choose from
Actionscript, C, C#, C++, Clojure, Fortran, Go, Java, Javascript, Python, Ruby, Visual Basic, ...
So many to choose from
Actionscript, C, C#, C++, Clojure, Fortran, Go, Java, Javascript, Python, Ruby, Visual Basic, ...
Most not suitable for systems development ...
hard-to-predict or poor performance
So many to choose from
Actionscript, C, C#, C++, Clojure, Fortran, Go, Java, Javascript, Python, Ruby, Visual Basic, ...
Most not suitable for systems development ...
hard-to-predict or poor performance
reliance on hard-to-manage runtime machinery e.g. "garbage collection" or atomic ref-counting
... but the languages remaining are unsafe ...
... and complicate utilization of available (multicore) parallelism.
Example systems code: direct access to bytes in memory
buffer = new String("Hello");
Example systems code: direct access to bytes in memory
buffer = new String("Hello"); interior = &buffer[2..]; assert_eq!(interior[0], 'l');
buffer.append(" all!"); // adds five more bytes
assert_eq!(interior[0], 💣); // 😱
Thread 1 | Thread 2 |
---|---|
buf.append(" left"); |
buf.append(" right"); |
Both threads want to update buf
What is outcome?
"Hello left right"
?
"Hello right left"
?
Again, must reallocate underlying buffer
Data Race! At end could be any of:
"Hello left right"
(Thread 1 finishes before Thread 2 starts)
"Hello right left"
(Thread 2 finishes before Thread 1 starts)
"Hello left"
(Both start at same time, Thread 2 "wins")
"Hello right"
(Both start at same time, Thread 1 "wins")
Prevent all bugs of this nature
If your Rust code compiles, it does not have:
dangling references
buffer overflows
crashes (segmentation faults)
remote code execution vulnerabilities
data race conditions (big win for parallel systems)
No popular systems language offers all of above properties
(only ones from research labs)
Hard to prototype changes atop C++ (e.g. Firefox today yesterday)
Rust ⇒ Servo; Servo ⇒ Parallel CSS, WebRender
Want Rust for next-gen infrastructure (services, IoT)
Mozilla's mission statement
"Our mission is to ensure the Internet is a global public resource, open and accessible to all. An Internet that truly puts people first, where individuals can shape their own experience and are empowered, safe and independent."
Original audience was systems programmers: C/C++, focus on enabling interoperation between Rust and C
But: also have attention from elsewhere
Of 1987 Rust users surveyed, 732 left C and C++ unchecked
Rust has been open source since the beginning
Open governance model based on public RFCs
We have an active, amazing community
We have had a code of conduct from the outset, stressing inclusiveness, and evolving it as needed
The Rust community seems to be populated entirely by human beings. I have no idea how this was done. I suspect Graydon Hoare deserves a large share of the credit for leading by example but everyone I have interacted with in the community has been friendly and patient.
http://scattered-thoughts.net/blog/2015/06/04/three-months-of-rust/
We still need help improving diversity, though; see 2016 survey.
Skylight swapped Rust for Ruby back in 2014
Maidsafe went from C++ to Rust in 2015
Dropbox moved Diskotech from Go to Rust in 2016
and ported Broti compression from C to Rust too
Friends of Rust: organizations using Rust in production
If you are a C/C++ programmer ...
... tired of debugging crashes and/or multithreaded programs
You might want to try Rust
If you are a "high-level programmer" (Javascript, Ruby) ...
... and you want to expand your mind/skill-set
You might want to try Rust
Firefox 48 had the first bits of Rust (media parser)
Servo marches on (e.g WebRender 2)
Incremental integration with Gecko (e.g. Stylo); want "best of both worlds"
To learn more, contact the Servo team, especially @pcwalton
Or try out Servo yourself! Nightlies
Still establishing vision for 2017; discussion link
Initial proposals:
Lower learning curve
Faster compiler
Integrated Dev Environment (IDE) support
Advanced abstractions for concurrency and parallelism
More seamless Foreign Function Interface (FFI)
"Hack Without Fear" https://www.rust-lang.org/