FunctionalTV
Rust outperforms hand-optimized C by pairing cache-conscious data structures with compile-time ownership, offering systems engineers a way to eliminate systemic firmware security flaws without sacrificing execution speed.
AI-assisted summary of Scale By The Bay 2018: Bryan Cantrill, Rust and Other Interesting Things — original source. Check the original for full context.
Source published:
Key ideas
- Programming language selection fundamentally boils down to aligning team and problem values with community trade-offs, as demonstrated by the contrasting design philosophies of C, OpenBSD, Awk, and K. (2:05)
- The 2018 Meltdown and Spectre hardware vulnerabilities proved that systems software cannot preserve security if the underlying microprocessor layer compromises it for raw performance. (14:17)
- Rewriting a performance-critical C application in Rust outpaced hand-optimized C because Rust enabled the practical use of cache-efficient B-trees over memory-fragmenting AVL trees. (27:10)
- Bryan Cantrill argues that computing is in an existential conflict with buggy legacy assembly and C firmware, positioning memory-safe Rust as the primary weapon to modernize the substrate. (33:39)
Detailed notes
## Background Published on YouTube by FunctionalTV on December 10, 2018, this video captures a talk from the Scale by the Bay 2018 conference. According to the description, Bryan Cantrill—CTO of Joyent, former Sun Microsystems Distinguished Engineer, and core contributor to Solaris, ZFS, and DTrace—reflects on his recent experience picking up and working with Rust.
## TL;DR Bryan Cantrill frames programming language selection around platform values and technical trade-offs, illustrating how C's singular dedication to performance forced generations of systems engineers to shoulder safety and stability manually. Recounting the industry crisis around Spectre and Meltdown, he argues that foundational infrastructure urgently requires both bare-metal performance and unyielding software integrity. Cantrill details how rewriting a performance-critical, hand-optimized C component in idiomatic Rust ended up outperforming the original C implementation thanks to Rust's cache-friendly collection primitives and ownership model. He highlights language features like algebraic data types, hygienic macros, and explicit unsafe boundaries, positioning Rust as a transformative technology for user-level infrastructure and the broader industry fight to modernize brittle hardware firmware.
## Atmosphere & style Cantrill delivers an electric, rapid-fire presentation defined by his trademark caustic wit, theatrical comedic timing, and deep systems engineering battle scars. The audience is kept actively engaged and laughing as he fires off irreverent metaphors—from comparing permissive languages to Montessori preschools to describing Rust's unsafe keyword as a conjugal visit with raw memory. The talk moves through an evocative arc from developer despair over stagnant systems tools to infectious, hard-earned optimism, creating the feeling of a veteran practitioner having a genuine technical epiphany on stage.
## Bulletin - [02:05](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=125s) Programming language selection fundamentally boils down to aligning team and problem values with community trade-offs, as demonstrated by the contrasting design philosophies of C, OpenBSD, Awk, and K. - [14:17](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=857s) The 2018 Meltdown and Spectre hardware vulnerabilities proved that systems software cannot preserve security if the underlying microprocessor layer compromises it for raw performance. - [27:10](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1630s) Rewriting a performance-critical C application in Rust outpaced hand-optimized C because Rust enabled the practical use of cache-efficient B-trees over memory-fragmenting AVL trees. - [33:39](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=2019s) Bryan Cantrill argues that computing is in an existential conflict with buggy legacy assembly and C firmware, positioning memory-safe Rust as the primary weapon to modernize the substrate.
## Key takeaways - [04:06](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=246s) All platform attributes like performance, robustness, and expressiveness are desirable, but platforms are defined strictly by how they resolve direct trade-offs between them. - [02:05](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=125s) Adopting an open-source platform means adopting its community, whose shared values will actively reinforce and steer future technical trade-offs. - [05:49](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=349s) C was engineered primarily as portable assembly focused almost entirely on performance and interoperability, adding language features like structs only out of sheer operational necessity. - [09:57](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=597s) Specialized platforms illustrate radical value prioritization: K prioritizes extreme expressiveness and brevity, OpenBSD sacrifices performance entirely for security, and Awk values simplicity and documentation. - [14:17](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=857s) The Meltdown and Spectre microprocessor crises in 2018 exposed the severe risks of hardware silently trading security away in pursuit of performance. - [17:11](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1031s) Systems software carries an exhaustive, non-negotiable list of requirements including robustness, integrity, debuggability, compatibility, and uncompromising performance. - [19:02](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1142s) C and C++ share only one core value with systems software—performance—leaving the burden of memory safety, stability, and security entirely on the developer. - [23:27](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1407s) Dynamic platforms like Node.js prioritize approachability and developer growth, an ethos fundamentally misaligned with the rigorous edge-case correctness required in systems programming. - [25:05](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1505s) Rust resolves C's fatal composition flaw by enforcing compile-time ownership and borrowing rules without requiring a garbage collection runtime. - [28:32](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1712s) An idiomatic Rust rewrite outperformed hand-optimized C because modern memory hierarchies favor cache-friendly B-trees over pointer-chasing AVL trees. - [29:39](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1779s) Algebraic data types and hygienic macros provide systems programmers with powerful, compiler-verified tools for error handling and metaprogramming. - [29:39](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1779s) Rust's `unsafe` block does not compromise system integrity; instead, it confines necessary low-level operations to isolated, auditable boundaries. - [31:37](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1897s) Rust consciously shifts cognitive load from production runtime incidents directly onto the developer during compiler interactions. - [31:37](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1897s) Rust avoids a mandatory full-system rewrite by relying on seamless C Foreign Function Interface (FFI) interoperability to enable incremental modernization. - [33:39](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=2019s) Modernizing brittle, insecure hardware firmware written in legacy C and assembly represents the most critical immediate opportunity for Rust adoption.
## Detailed walkthrough ### [00:14](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=14s) Stepping into the Functional World via JavaScript
Bryan Cantrill opens by welcoming the audience and joking that this is likely the first—and perhaps only—time in his life that he finds himself speaking in a functional programming track. As an operating systems and systems software programmer, functional programming was simply not on the menu for most of his career. Despite having a degree in computer science, he confesses that he did not truly appreciate or understand functional concepts until he started programming in JavaScript around late 2005 and 2006.
At that time, the industry was riding the wave of Ajax—an acronym for Asynchronous JavaScript and XML that Bryan criticizes as the “worst acronym ever” because one letter was a conjunction and another was an abbreviation of an acronym. As developers waded into the browser to build richer web applications, they realized JavaScript was far more than a toy language meant for blink tags. Working with it led to genuine revelations about programmatic power: closures, lambdas, and first-class functions. While Joyent later leaned heavily into JavaScript for various layers of their stack, deeper systems software remained largely cut off from that level of expressiveness. Systems programmers were stuck, but Bryan senses the landscape is finally beginning to shift.
[02:05](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=125s) Defining Platform Values and Community Fit
Before exploring new languages, Bryan argues that decisions must be framed through the lens of platform and software values. He defines values as positive traits that a team, language, or ecosystem must choose amongst when forced into trade-offs. While developers frequently criticize or applaud the design choices made by different platforms, those reactions are fundamentally reflections of their own personal values compared against the system's values. Furthermore, an engineer's values are not static; they shift depending on the specific problem being solved, and the chosen software ought to reflect those specific requirements.
In a post-open-source world, selecting a programming language or software platform means selecting an open-source community. Bryan warns that adopting technically impressive software managed by a community that does not share your values inevitably leads to friction, noting: “If the community doesn't reflect your values, you will find that the software will come to not reflect your values as well.” For a platform to remain healthy and appropriate for a task, its community, its technical goals, and the user's operational values must align.
[04:06](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=246s) The Tension Between Incompatible Values
Displaying a broad, alphabetical list of desirable software attributes—such as performance, robustness, debuggability, composability, and expressiveness—Bryan points out that every single item on the list is intrinsically good. No software engineer would dismiss any of these traits as garbage that nobody wants. However, software platforms cannot optimize for all of them simultaneously.
```mermaid flowchart TD accTitle: Value Selection and Cultural Reinforcement accDescr: Platform values attract aligned developers who then defend and preserve those core traits. subgraph Decisions["Platform Trade-offs"] A["All Desirable Values<br>(Performance, Robustness, Expressiveness, etc.)"] -->|"Trade-off choices"| B["Core Values"] end subgraph Culture["Community Feedback Loop"] B -->|"Attracts"| C["Like-minded Engineers"] C -->|"Defend & reinforce"| B end ```
The decisive question for any platform, community, or language is what gets prioritized when two positive traits come into direct conflict. As Bryan highlights, “The real question is when you have to make a choice between two of them, what do you choose?” That decision defines the core values of the platform. Once established, these core values act as a magnet for like-minded developers. This creates a self-fulfilling, self-reinforcing prophecy where the incoming community actively fights to protect and defend those original trade-offs across generations of software development.
[05:49](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=349s) The Origins and Core Values of C
To illustrate how values shape languages, Bryan examines the history of C. A common misconception is that C and UNIX were identical twins delivered together from the birth canal. In reality, UNIX predated C; it was written originally in assembly language. Although Ken Thompson had created the B language, B was interpreted and slow, relegating it to ancillary parts of the system rather than the kernel itself. The Bell Labs team realized they needed a structured, higher-level language specifically to avoid writing the entire operating system in machine-specific assembly.
C was fundamentally conceived as portable assembly. Its paramount, number-one goal was performance, coupled tightly with interoperability. Because it directly modeled the underlying machine architecture, C was engineered to interface seamlessly with raw assembly and anything else capable of hardware execution. Furthermore, C was defined by radical simplicity and minimalism: - Features were only added to C when strictly required to implement UNIX. - Structures did not exist in early C; they were added only after the team recognized the practical difficulty of implementing UNIX data structures without them. - Because assembly lacked structures, the language initially omitted them until necessity forced their invention. - When trade-offs had to be made between expressiveness and raw machine performance, the designers consistently chose performance.
[08:19](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=499s) Extreme Minimalism and Expressiveness in K
Bryan contrasts C's systems-level trade-offs with the esoteric array language K (and its successor Q), created by Arthur Whitney. Bryan characterizes Whitney as operating on an entirely “different astral plane” when it comes to programming language design. Influenced by Ken Iverson, who was Whitney's neighbor and taught him APL when he was just four years old, Whitney became convinced that APL is so natural that it could easily be taught to any four-year-old child.
Bryan recounts an anecdote where Whitney insisted on proving this theory: - Whitney offered to teach Bryan's own four-year-old child APL. - Bryan firmly declined the offer, convinced that his child would simply be miserable and frustrated, remarking that the attempt would end poorly for everyone involved. - Despite passing on the challenge, Bryan deeply admires the unique mindset of a creator who genuinely believes APL is universal enough for a preschooler.
In K, the overriding core values are minimalism and extreme expressiveness pushed to the outer limits. Whitney's design aesthetic prioritizes writing an entire program using the absolute fewest characters possible. Bryan observes that to Arthur Whitney, software beauty is measured strictly by brevity, humorously wondering whether Whitney fears he will face vivid punishment in the afterlife for every extra keystroke he uses.
[09:57](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=597s) Values in the Wild: K, OpenBSD, and Awk
Bryan Cantrill illustrates how clarifying core values can be by walking through contrasting technologies. In array languages like K, the driving principle is extreme expressiveness paired with raw performance, often applied to high-frequency market-facing operations. Maintainability and readability are discarded entirely: code is squeezed denser and denser until it resembles line noise from a dial-up modem when someone picked up the house phone. Yet within its chosen value framework, it is regarded as beautiful.
In sharp contrast stands OpenBSD, where security is not merely a priority—it is the solitary core value. If achieving security requires making the entire operating system dramatically slower, the OpenBSD developers will happily do it. Cantrill points out their decision to disable hyper-threading because they concluded it was unsafe at any speed: users lost half of their virtual cores, but from OpenBSD's perspective, those execution contexts were never truly secure against side-channel attacks anyway. Cantrill finds this absolute transparency admirable: “It’s actually incredibly clarifying when you have a system that is so upfront and transparent about this is what we care about.”
Cantrill then contrasts these specialized tools with Awk, a language he uses daily for three or four quick one-liners. Created by Alfred Aho, Peter Weinberger, and Brian Kernighan, Awk focuses squarely on simplicity, approachability, and speed of composition. Cantrill highlights its documentation as an unrivaled benchmark:
> “The Awk Programming Language I think is an absolute model of programming language documentation.”
The classic 130-page book can be read and mastered in two hours flat, giving the programmer a complete, self-contained understanding of the entire tool.
- **K Language Values**: Expressiveness and raw execution speed above all; readability and maintainability are deliberately sacrificed. - **OpenBSD Stance**: Security over compromises—willingly sacrificing hyper-threading and half the available virtual cores to eliminate side-channel vulnerabilities. - **Awk Documentation**: Roughly 130 pages long, completely consumable in a single sitting, and leaves no hidden complexities behind.
---
[12:34](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=754s) Examining Scala’s Core Values
Cantrill turns his lens toward the host conference's primary language, Scala. Admitting humorously that he has never written a line of Scala himself—and that he placed a question mark on his slide to avoid an angry mob throwing chairs—he uses the language to show how developers naturally gravitate toward ecosystems whose values align with their own.
For Scala, Cantrill identifies expressiveness, robustness, composability, and, most crucially, interoperability as bedrock principles. Reusing Java classes while adding language-level integrity and safety was central to Martin Odersky's original vision when Cantrill first saw him present Scala around 2004. Cantrill references the conference panel from the previous evening, noting that Odersky's stated roadmap revolves around making it easier to write robust software. He also observes that pruning legacy baggage, such as XML literals, demonstrates a commitment to shedding language features that no longer serve those core architectural principles.
```mermaid flowchart LR accTitle: Scala Core Values accDescr: Diagram illustrating Scala's core values connecting to its JVM foundation. subgraph CoreValues["Scala Core Values"] EXP["Expressiveness"] ROB["Robustness & Integrity"] CMP["Composability"] INT["Interoperability"] end subgraph Foundation["Execution Platform"] JVM["Java Ecosystem / JVM Classes"] end INT -->|"seamless reuse"| JVM ROB -->|"clean design"| CoreValues ```
- **Interoperability**: Fundamental to Scala's existence; allows developers to leverage existing JVM libraries without sacrificing expressiveness. - **Pruning Features**: Removing historical additions like XML literals aligns the language more closely with simplicity and robustness. - **Audience Takeaway**: Identifying what values you prioritize explains why you choose specific tools and platforms.
---
[14:17](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=857s) System Software Foundations and the Meltdown/Spectre Crisis
When building system software—the foundations beneath applications—values cease to be optional aesthetic choices; they are dictated by users' non-negotiable expectations. An operating system that crashes or compromises integrity is quickly abandoned because high-level software cannot possess qualities that its underlying substrate fails to provide.
Cantrill recounts how 2018 became an *annus horribilis* for systems engineers. On January 2, 2018, he read a Hacker News post reverse-engineering Linux kernel patches, uncovering massive speculative-execution flaws (Spectre and Meltdown) in Intel microprocessors. The hardware industry had spent decades quietly trading security away in favor of performance, and the entire computing industry was complicit because users demanded faster chips. However, once that lowest substrate compromised security, the layers above lost their footing:
> “It doesn’t matter how dear you hold security if you have hyper-threading enabled... because the hyper-threading itself is not secure, or it doesn’t matter if you don’t have kernel page table isolation, doesn’t matter how dear you hold it because now you are vulnerable to an attack from a substrate that ultimately chose something else over security.”
Systems engineers lost the entirety of 2018 simply trying to crawl back to the baseline of hardware security they mistakenly assumed they already had on December 31, 2017.
```mermaid flowchart TD accTitle: Hardware Vulnerability Ripple Effect accDescr: Flowchart showing how microprocessor architectural trade-offs break higher-level security assumptions. subgraph Microprocessor["Microprocessor Substrate"] HW["Intel Hardware Design"] PERF["Prioritized Raw Performance"] FLAWS["Speculative Execution Flaws<br/>(Meltdown & Spectre)"] HW --> PERF PERF --> FLAWS end
subgraph SystemsLayer["Operating System & Software"] KPTI["Kernel Page Table Isolation (KPTI)"] NOHT["Disabling Hyper-Threading"] LOSS["Performance & Engineering Setback"] FLAWS --> KPTI FLAWS --> NOHT KPTI --> LOSS NOHT --> LOSS end ```
---
[17:11](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1031s) The Demanding Value Set of Systems Infrastructure
Cantrill enumerates the exhaustive slate of values that systems software must simultaneously satisfy: compatibility, debuggability, integrity, performance, resilience, robustness, safety, security, stability, thoroughness, and transparency. Upgrades to processors, operating systems, or databases can never arbitrarily break existing user code, and when failures inevitably occur, systems must provide transparent visibility to explain why.
While quoting his late former Sun Microsystems colleague Roger Faulkner—who quipped that “performance is the root of all evil”—Cantrill emphasizes that performance cannot be discarded. Software performance directly governs infrastructure economics, meaning engineers cannot allow cycles to be wasted unnecessarily. Even fighting for small two-percent margins becomes an exhausting yet mandatory battle. Furthermore, foundational software cannot be purpose-built or narrow; it must exhibit exhaustive thoroughness to support arbitrary generic workloads while remaining open and auditable, steering away from opaque proprietary codebases.
- **Roger Faulkner's Dictum**: Roger Faulkner, a legendary engineer at Sun Microsystems, often reminded peers that “performance is the root of all evil,” because pursuing it introduces immense architectural complexity. - **Economic Constraint**: Performance cannot simply be abandoned, as hardware cycles directly translate into operating costs. - **Generic Requirements**: Core components like databases and kernels must be thorough and generic enough to run unpredictable workloads safely. - **Transparency**: Systems require open, inspectable code over proprietary black boxes, a tension resurfacing with the rise of modern cloud architectures.
[19:02](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1142s) The Core Values Mismatch: C, C++, and Performance
```mermaid flowchart TD accTitle: System Software Values versus C and C++ Reality accDescr: Diagram illustrating the clash between the values demanded for system software and what C and C++ actually deliver.
subgraph Demands ["System Software Demands"] V1["Robustness / Safety"] V2["Security"] V3["Stability"] V4["Interoperability"] V5["Performance"] end
subgraph Languages ["Language Alignment"] C["C: Driven Almost Solely by Performance"] CPP["C++: Expressive, Anti-Simplicity, Poor Interop"] end
V5 -->|"Only Shared Value"| C V5 -->|"Shared Value"| CPP V1 -.->|"Burden on programmer, not language"| C V4 -.->|"Name mangling and brittle bindings"| CPP ```
Cantrill reviews the values demanded for systems software versus the actual core values of C and C++. Toggling rapidly between the two sets like an eye exam—"right eye, left eye, right eye, left eye"—he demonstrates that C shares only a single core value with what we require: performance. Everything else is missing. Noting that Roger Faulkner passed away a couple of years earlier, Cantrill jokes that Faulkner's ghost is vindicated, remarking that “performance actually is the root of all evil here.” In system software, performance is non-negotiable; users will not accept a system that excels in every other attribute if it lags in performance. The graveyard of operating systems is littered with capability-based or microkernel designs that fell down on this single hurdle.
Turning to C++, Cantrill notes that it openly rejects simplicity, joking that he needs a strikethrough effect because C++ is actively "anti-simplicity." While C++ values expressiveness, it struggles severely with interoperability. In theory, it remains a superset of C, but in practice, non-C++ code communicating with C++ components is excruciating. Due to issues like name mangling, developers must design C++ components explicitly around a C interface to allow interoperability. This leaves system software with a gaping disconnect: the dominant languages prioritize performance above all, while developers shoulder the entire burden of providing robustness, security, and stability. Cantrill observes:
> “The language is allowing me to do whatever I want it's you know it's like a Montessori Preschool as long as we all worship at the altar of performance.”
- Decades of system stability have been achieved despite C rather than because of it, sustained purely by experienced programmers, exhaustive code reviews, bespoke tooling, and testing. - Cantrill admits he has zero memory dereference bugs in his own C code because of decades of practice with `malloc` and `free`, but acknowledges that no safety net is supplied by the language itself.
[23:27](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1407s) Despair, Node.js, and the False Hope of Approachability
Cantrill describes reaching a point of despair over whether systems languages would ever change. Many had hoped higher-level environments could bridge the divide. Joyent famously invested heavily in Node.js, and Cantrill recalls his optimistic belief that it might save software development by enabling robust server-side systems written in a dynamic language. Instead, he concluded, “it's just JavaScript, dude.”
The problem is not that JavaScript's values are bad, but that they are fundamentally misaligned with system software. JavaScript prioritizes developer velocity and approachability—welcoming as many newcomers as possible. Cantrill explains the inevitable philosophical tension: if faced with an abstraction that allows ten thousand more programmers to write code, but introduces obscure edge conditions they might never understand, an approachability-driven ecosystem says yes, while a robustness-driven systems programmer must say an emphatic no. As Cantrill puts it:
> “If your first value is robustness you say no of course not if your first value is approachability and growth then yes of course you should and that is the fundamental tension for us.”
- Approachability maximizes community expansion, whereas systems programming demands absolute predictability and edge-case correctness. - The lack of modern systems-level alternatives that placed correctness alongside performance left Cantrill disillusioned about the industry's trajectory.
[25:05](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1505s) Discovering Rust and the Ownership Model
Cantrill’s skepticism began to lift as he followed the evolution of Rust, a language that originated around 2006 and slowly gathered momentum. Over time, he became increasingly "Rust curious," drawn in by its radical approach to memory management. Rather than relying on a runtime garbage collector or abandoning the programmer to manual pointer tracking, Rust introduces a strict compile-time system of ownership and borrowing.
In Rust, the compiler forces the programmer into an explicit contract: you follow its ownership rules, and in return, the compiler automatically determines exact allocation and deallocation points. This yields the dynamic developer ergonomics of a garbage-collected runtime combined with the raw speed and zero-cost abstraction of explicit memory management. More crucially, Rust addresses C’s greatest defect: composition. In C, memory leaks and corruptions almost always occur across component and library boundaries, where ownership of dynamically allocated memory is ambiguous or dropped. Rust's strict ownership boundaries make high-level composition safe and practical. Cantrill summarizes the developer experience:
> “The compiler is gonna restrict what you do and you're not going to burst into tears when it does it that's like that that's the bargain that you're gonna have with the compiler.”
[27:10](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1630s) The Rewrite: Beating Hand-Optimized C
```mermaid flowchart LR accTitle: Data Structure Comparison Between C and Rust accDescr: Flow diagram showing how Rust's B-Tree outperforms the hand-optimized C AVL tree by optimizing for memory hierarchies and CPU caches.
subgraph C_Impl ["Hand-Optimized C Version"] direction TB C1["AVL Tree Data Structure"] C2["Pointer chasing across memory"] C3["Rebalance heavy on CPU cache misses"] end
subgraph Rust_Impl ["Idiomatic Rust Version"] direction TB R1["B-Tree Data Structure"] R2["Cache-friendly node grouping"] R3["Treats DRAM as a slow disk"] end
C_Impl -->|"Loses to"| Rust_Impl ```
To validate his interest, Cantrill decided to rewrite a piece of performance-critical, hand-optimized C software in Rust. The early stages were an uphill battle against the borrow checker. Taking the attitude of "let the Wookiee win," he stopped fighting the compiler and wrote code in a way that felt naive and suboptimal simply to get it to build: “I don't even care about performance anymore just let me get this thing working.”
Expecting poor performance, Cantrill benchmarked the completed Rust implementation against his original C code and was shocked to find that the Rust code ran significantly faster. Investigating the profile, he discovered why: the application spent nearly all its execution time balancing a binary tree. In C, Cantrill had relied on an AVL tree implementation he had trusted for years. In Rust, he utilized the standard collection primitives, which favor a `BTree`. While B-trees were historically relegated to database systems managing spinning disks, Rust's designers recognized that modern hardware memory hierarchies make DRAM behave like disk relative to CPU caches. Cantrill points out:
> “The Rust observation is actually with the memory hierarchy being what it is a B-tree actually makes sense just in software that's not talking to disk you can view DRAM as the disk that you're dealing with.”
[28:32](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1712s) Outperforming C and the Core Values of Rust
Examining his benchmark results, Bryan Cantrill points out that choosing a B-tree data structure makes vastly more sense for the problem at hand, but implementing one in C is notoriously difficult. With Rust, developers can pull in a standard B-tree implementation immediately without needing to understand or maintain its internal mechanics. Consequently, the Rust implementation decisively outperformed his hand-optimized C code—partly due to the superior data structure, but also because Rust’s ownership semantics provide compiler guarantees that unlock optimizations unavailable in C. When skeptics suggested the gap might simply be a GCC limitation and asked how Clang fared, Cantrill retorted: “Clang is not gonna fundamentally change the physics of my C.” Clang yielded a minor improvement, but Rust still comfortably beat it on runtime.
```mermaid flowchart TD accTitle: Rust Core Values accDescr: Hierarchy of core architectural values in Rust centered on performance. subgraph Core ["Foundation"] P["Performance (Epicenter)"] end subgraph HighLevel ["Expressiveness"] C["Composability"] E["Expressiveness"] ADT["Algebraic Data Types"] end subgraph Systems ["Systems Rigor"] S["Safety & Integrity"] FFI["Interoperability (FFI)"] U["Confined Unsafe Escape Hatch"] end P --> HighLevel P --> Systems ```
Cantrill highlights how these benchmark results reflect the overarching value system of Rust. While raw execution speed sits at the literal epicenter of the universe for systems programming, Rust couples that baseline speed with the composability and high-level expressiveness that languages like Scala have enjoyed for years. Beyond ergonomics, Rust brings safety, security, rigor, robustness, and integrity to bare-metal systems. Crucially, it combines these with deep interoperability. As Cantrill notes, Rust distinguishes itself from other modern languages because it does not attempt to declare absolute hegemony or demand that developers discard working infrastructure: “Rust does not aspire to rewrite everything in Rust; Rust is trying to cooperate with those systems that already exist.”
[29:39](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1779s) Discovering Clean Water: Algebraic Types, Macros, and Unsafe
Turning to language features, Cantrill jokes about the amusing spectacle of veteran systems programmers stumbling into functional programming paradigms and treating algebraic data types like a revolutionary new invention. He compares it to someone marveling at municipal tap water: “It's like, ‘Hey, I just found out like I'm getting clean water out of the tap, I don't have to boil it!’ and you're just like, ‘Yes, you knucklehead, clean water! It's valuable, like your babies are no longer dying, it's amazing!’” While algebraic data types were familiar to him in the abstract, using them directly in systems software makes error handling exceptionally concise and produces markedly more robust software.
Cantrill admits he had worked so far away from hygienic macros in his C career that he did not even know how to spell "hygienic" before learning Rust. While the C preprocessor was indispensable throughout his career—noting he could not have written the software he built without it—Rust’s hygienic macro system operates on another plane of power. He pairs this with high praise for Rust’s Foreign Function Interface (FFI) and its explicit `unsafe` keyword. Cantrill describes `unsafe` as a controlled escape hatch, likening it mid-sentence to a prison furlough program or a “conjugal visit with your memory,” before instantly catching himself on stage and laughing that the metaphor was already out of his mouth and undoubtedly live-tweeted. On a serious note, he argues that the true brilliance of `unsafe` is that it allows developers to relax compiler invariants in strictly isolated, audit-friendly pockets of the codebase without letting undefined behavior poison the entire architecture.
- Algebraic data types transform messy systems error handling into concise, compiler-verified state transitions. - Hygienic macros replace error-prone C preprocessor textual substitution with structured syntax manipulation. - Rust's C FFI enables seamless calls between native C libraries and Rust without requiring full-system rewrites. - The `unsafe` keyword isolates low-level pointer arithmetic and manual memory operations into explicit, auditable boundaries.
[31:37](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1897s) Cognitive Load and the Perils and Promise of the Compiler
The central trade-off of Rust is where it places the mental strain of engineering. Rust intentionally shifts cognitive load away from production operators responding to catastrophic runtime failures and dumps it squarely onto the developer writing code at their desk. For systems builders tired of debugging race conditions in production cores, this trade-off is welcome, but it can make the early development experience feel agonizing. The compiler flags issues that feel pedantic to programmers accustomed to the permissive laxity of C, leading many newcomers into prolonged arguments with the borrow checker. Yet time and again, developers realize the compiler was catching a genuine, latent bug. Quoting Jim Blandy and Jason Orendorff's *Programming Rust*, Cantrill highlights this dynamic:
> “You have a period of intense arguing with the compiler, at the end of which the code looks rather nice, as if it'd been a breeze to write, and runs beautifully.”
Cantrill acknowledges the perils of the language as well: Rust provides much less leverage when engineers attempt to perform direct, line-by-line rewrites of working extant systems that rely heavily on complex, multiply-owned reference graphs, such as monolithic operating system kernels. However, Rust’s commitment to interoperability mirrors the historical adoption curve of C. Developers do not need to rewrite the entire universe on day one; they can iteratively carve out individual subsystems and modernize them in Rust, much like the Scala ecosystem achieved success through its smooth interoperability with Java.
[33:39](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=2019s) The War with Firmware and Future Opportunities
Looking beyond traditional operating system kernels, Cantrill sees enormous immediate potential for Rust across user-level systems infrastructure. If an engineer were building an initiative like systemd or any modern user-level service supervisor today, Cantrill states unequivocally that Rust would be the only logical choice. Most urgently, he points down the stack toward the unseen code executing beneath the OS: the massive, opaque body of platform firmware.
> “I've been fond of saying, but I believe it fervently, that we are engaged in a war with firmware: it is humanity versus firmware, and everyone needs to pick a side.”
Virtually all contemporary firmware remains trapped in legacy assembly and C, creating brittle, insecure systems foundations. Cantrill views replacing these legacy firmware implementations with memory-safe Rust as one of the most critical missions facing computing infrastructure. Rebutting maximalists, he cautions that Rust is not a universal hammer for every domain, and engineers should remain skeptical of anyone claiming it is. But for core systems software, Rust proves the community's favorite adage true: developers really can have nice things.
[35:07](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=2107s) Q&A: Memory Safety Invariants and Non-Systems Domains
Opening the floor to questions with an apology for running into "negative five minutes" of allotted time, Cantrill addresses an attendee's question about interfacing with lower-level operating system APIs like `mmap`. When interacting with C interfaces, code can easily zero out address spaces or violate memory boundaries. Cantrill clarifies that calling primitives like `mmap` to map objects directly into an address space is fundamentally an unsafe operation in Rust. By mandating that such calls occur inside an explicit `unsafe` block, Rust forces developers to isolate the boundary where invariants could break: “I think what it's doing is confining that unsafety such that you're aware of it, so it does help you out in that it limits it, as opposed to letting that poison an entire application.”
A second audience member asks whether Cantrill sees a future for Rust outside traditional systems software, specifically in domain spaces like game engines or shared data libraries that cooperate across diverse tech stacks. Cantrill enthusiastically affirms this cross-pollination: “Any place where these values are important, Rust is gonna have a place, and in particular where these are the choices you want to make, and in particular, particular where performance is your overarching value, I think Rust is absolutely gonna have a place.” With that final endorsement, Cantrill concludes the presentation to applause.
## Notable quotes > [02:05](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=125s) If the community doesn't reflect your values, you will find that the software will come to not reflect your values as well. — Bryan Cantrill
> [28:32](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=1712s) Rust does not aspire to rewrite everything in Rust; Rust is trying to cooperate with those systems that already exist. — Bryan Cantrill
> [33:39](https://www.youtube.com/watch?v=2wZ1pCpJUIM&t=2019s) I've been fond of saying, but I believe it fervently, that we are engaged in a war with firmware: it is humanity versus firmware, and everyone needs to pick a side. — Bryan Cantrill
## Mentioned Bryan Cantrill, Joyent, Sun Microsystems, Solaris, ZFS, DTrace, JavaScript, Ajax, C, C++, UNIX, Ken Thompson, B, Arthur Whitney, Ken Iverson, APL, K, Q, OpenBSD, Awk, Alfred Aho, Peter Weinberger, Brian Kernighan, The Awk Programming Language, Scala, Java, Martin Odersky, Spectre, Meltdown, Intel, Roger Faulkner, Node.js, Rust, GCC, Clang, Jim Blandy, Jason Orendorff, Programming Rust, systemd
## Video description This talk video is a node in devreal.ai, the developer community graph. It connects to: Talk: Rust and Other Interesting Things — https://devreal.ai/t/181116-rust-other-interesting-things-scale-by-the-bay Speaker: Bryan Cantrill — https://devreal.ai/n/bryan-cantrill Company: Joyent — https://devreal.ai/c/joyent Event: Scale by the Bay — https://devreal.ai/e/181114-scale-by-the-bay-conference
Explore these connections and related videos, photos, speakers’ blogs and podcasts, and other By the Bay networks. ----- Bryan, the CTO of Joyent, and a core contributor to Solaris, ZFS, and DTrace, formerly a Distinguished Engineer at Sun, has recently picked up Rust. He'll share his experience with us.
[Source](https://www.youtube.com/watch?v=2wZ1pCpJUIM)