HackerTube
HomeLongsLikedHistoryWatch laterCategoriesPlaylistsSettings

2017 LLVM Developers’ Meeting: “Implementing Swift Generics ”

LLVM2 HN recommenders · recommended in 2 months, 2017-2026
YouTube
21K views · 9 years ago · talk · evergreen

Swift compiler engineers explain how Swift implements generics using dictionary-passing with reified type metadata. They compare it with Java-style uniform representation and C++ or Rust monomorphization.

Recommended as the clearest explanation of how Swift generics compile and how that differs from other languages.

Compilers, interpreters & program analysisProgramming language design#swift#generics#llvm#compilers#typemetadata#abi

4 comments from Hacker News

@mananaysiempre2026 · in “A tail-call interpreter in (nightly) Rust”

> It doesn't make sense to me that an embedded VM/interpreter could ever outperform direct code. You're adding a layer of abstraction and indirection, so how is it possible that a more indirect solution can have better performance? It is funny, but (like I’ve already mentioned[1] a few months ago) for serialization(-adjacent) formats in particular the preferential position of bytecode interpreters has been rediscovered again and again. The earliest example I know about is Microsoft’s MIDL, which started off generating C code for NDR un/marshalling but very soon (ca. 1995) switched to bytecode programs (which Microsoft for some reason called “format strings”; these days there’s also typelib marshalling and WinRT metadata-driven marshalling, the latter completely undocumented, but both data-driven). Bellard’s nonfree ffasn1 also (seemingly) uses bytecode, unlike the main FOSS implementations of ASN.1. Protocol Buffers started off with codegen (burying Google user in de/serialization code) but UPB uses “table-driven”, i.e. bytecode, parsing[2]. The most interesting chapter in this long history is in my opinion Swift’s bytecode-based value witnesses[3,4]. Swift (uniquely) has support for ABI compatibility with polymorphic value types, so e.g. you can have a field in the middle of your struct whose size and alignment only become known at dynamic linking time. It does this in pretty much the way you expect[5]: each type has a vtable (“value witness”) full of compiler-generated meth

CitesView on HN
@favorited2022 · in “Swift Project in 2023”

The Swift story around ABI stability and library evolution is pretty unique. Relatedly, its approach to generics doesn't fall into either of the 2 traditional paths (either box everything like Java and C#, or template instantiation like C++ or Rust). link ▶ this video

CitesView on HN
@favorited2022 · in “Compiling Swift Generics [pdf]”

Swift's generics have some unique properties at module boundaries to allow for a stable ABI while enabling library evolution. To get additional background, you might be interested in this[0] conference talk (the paper's author is one of the co-presenters). Also, this post[1] by a Rust and Swift compiler engineer talks about what Swift does differently than other languages, and the tradeoffs that are involved. [0] ▶ this video [1] link

RecommendsView on HN
@Veedrac2017 · in “Type Erasure in Swift”

If you're interested, there's a very nice talk on how Swift's generics compile. It's different to Rust in some key ways. ▶ this video

RecommendsView on HN
Swift for TensorFlow: The Next-Generation Machine Learning Framework (TF Dev Summit '19)31:22

Swift for TensorFlow: The Next-Generation Machine Learning Framework (TF Dev Summit '19)

TensorFlow
41K views • 7 years ago
I Interviewed The Creator Of LLVM, Clang, Swift, and Mojo1:05:45

I Interviewed The Creator Of LLVM, Clang, Swift, and Mojo

The PrimeTime
274K views • 2 years ago
2018 LLVM Developers’ Meeting:  C. Schafmeister “Lessons Learned Implementing Common Lisp with LLVM”26:01

2018 LLVM Developers’ Meeting: C. Schafmeister “Lessons Learned Implementing Common Lisp with LLVM”

LLVM
61K views • 7 years ago
"Type-Driven Program Synthesis" by Nadia Polikarpova39:40

"Type-Driven Program Synthesis" by Nadia Polikarpova

Strange Loop Conference
15K views • 8 years ago
2016 LLVM Developers’ Meeting: D. Dunbar “A New Architecture for Building Software”40:33

2016 LLVM Developers’ Meeting: D. Dunbar “A New Architecture for Building Software”

LLVM
7K views • 9 years ago
WWDC24: Go small with Embedded Swift | Apple22:17

WWDC24: Go small with Embedded Swift | Apple

Apple Developer
138K views • 2 years ago
Building Your Own Dynamic Language1:14:32

Building Your Own Dynamic Language

Stanford
21K views • 18 years ago
Twitter’s Quest for a Wholly Graal Runtime by Chris Thalinger50:11

Twitter’s Quest for a Wholly Graal Runtime by Chris Thalinger

Scala Days Conferences
3K views • 8 years ago
JSON Parser 100% From Scratch in Haskell (only 111 lines)1:50:07

JSON Parser 100% From Scratch in Haskell (only 111 lines)

Tsoding
205K views • 6 years ago
Demo: Base language, compile-time execution2:07:18

Demo: Base language, compile-time execution

Jonathan Blow
164K views • 12 years ago
Co-dfns Live Stream: Compiler Design and Architecture2:03:12

Co-dfns Live Stream: Compiler Design and Architecture

Aaron Hsu (arcfide)
21K views • 9 years ago
Breaking Down Programming Paradigms: APL's Surprising Learning Curve // Aaron Hsu // Dyalog '1759:03

Breaking Down Programming Paradigms: APL's Surprising Learning Curve // Aaron Hsu // Dyalog '17

Dyalog User Meetings
7K views • 9 years ago
Psp collections: views and more by Paul Phillips1:28:59

Psp collections: views and more by Paul Phillips

AI Council
11K views • 12 years ago
Demo: Implicit Context1:01:40

Demo: Implicit Context

Jonathan Blow
28K views • 11 years ago
2023 LLVM Dev Mtg - Mojo 🔥: A system programming language for heterogenous computing49:48

2023 LLVM Dev Mtg - Mojo 🔥: A system programming language for heterogenous computing

LLVM
61K views • 2 years ago
Introducing a Memory-Safe Successor Language in Large C++ Code Bases - John McCall - CppNow 20231:22:21

Introducing a Memory-Safe Successor Language in Large C++ Code Bases - John McCall - CppNow 2023

CppNow
18K views • 3 years ago
Sydney Golang Meetup - Rob Pike - Go 2 Draft Specifications1:07:00

Sydney Golang Meetup - Rob Pike - Go 2 Draft Specifications

Macquarie Group
57K views • 7 years ago
A 10x faster TypeScript13:45

A 10x faster TypeScript

Microsoft Developer
608K views • 1 year ago
JVMLS 2015 - Compilers are Databases1:08:52

JVMLS 2015 - Compilers are Databases

Java
16K views • 11 years ago
Clasp: Common Lisp using LLVM and C++ for Molecular Metaprogramming57:38

Clasp: Common Lisp using LLVM and C++ for Molecular Metaprogramming

Google TechTalks
52K views • 11 years ago