Write a Blog >>
SPLASH 2019
Sun 20 - Fri 25 October 2019 Athens, Greece
Thu 24 Oct 2019 16:22 - 16:45 at Attica - Optimization Chair(s): Tobias Wrigstad

Swift, an increasingly-popular programming language, advocates the use of protocols, which define a set of required methods and properties for conforming types. Protocols are commonly used in Swift programs for abstracting away implementation details; e.g., in a large industrial app from Uber, they are heavily used to enable mock objects for unit testing. Unfortunately, heavy use of protocols can result in significant performance overhead. Beyond the dynamic dispatch often associated with such a feature, Swift allows for both value and reference types to conform to a protocol, leading to significant boxing and unboxing overheads.

In this paper, we describe three new optimizations and transformations to reduce the overhead of Swift protocols. Within a procedure, we define LocalVar, a dataflow analysis and transformation to remove both dynamic dispatch and boxing overheads. We also describe Param, which optimizes the case of protocol-typed method parameters using specialization. Finally, we describe SoleType, a transformation that injects casts when a global analysis (like type-hierarchy analysis) discovers some protocol variable must have some concrete type. We also describe how these optimizations work fruitfully together and with existing Swift optimizations to deliver further speedups.

We perform elaborate experimentation and demonstrate that our optimizations deliver an average 1.56x speedup on a suite of Swift benchmarks that use protocols. Further, we applied the optimizations to a production iOS Swift application from Uber used by millions of customers daily. For a set of performance spans defined by the developers of the application, the optimized version showed speedups ranging from 6.9% to 55.49%. A version of our optimizations has been accepted as part of the official Swift compiler distribution.

Thu 24 Oct

Displayed time zone: Beirut change

16:00 - 17:30
OptimizationOOPSLA at Attica
Chair(s): Tobias Wrigstad Uppsala University
16:00
22m
Talk
Ryƫ Revisited: Printf Floating Point Conversion
OOPSLA
Ulf Adams Google
Link to publication DOI
16:22
22m
Talk
Optimization of Swift Protocols
OOPSLA
Raj Barik Uber Technologies Inc., Manu Sridharan University of California Riverside, Murali Krishna Ramanathan Uber Technologies Inc., Milind Chabbi Uber Technologies Inc.
DOI
16:45
22m
Talk
ApproxHPVM: A Portable Compiler IR for Accuracy-Aware Optimizations
OOPSLA
Hashim Sharif University of Illinois at Urbana-Champaign, Prakalp Srivastava University of Illinois at Urbana-Champaign, Muhammad Huzaifa University of Illinois at Urbana-Champaign, Maria Kotsifakou University of Illinois at Urbana-Champaign, Keyur Joshi University of Illinois at Urbana-Champaign, Yasmin Sarita Cornell University, Nathan Zhao University of Illinois at Urbana-Champaign, Vikram S. Adve University of Illinois at Urbana-Champaign, Sasa Misailovic University of Illinois at Urbana-Champaign, Sarita Adve University of Illinois at Urbana-Champaign
DOI
17:07
22m
Talk
IVT: An Efficient Method for Sharing Subtype Polymorphic Objects
OOPSLA
Yu-Ping Wang Tsinghua University, China, Xu-Qiang Hu Tsinghua Univeraity, China, Zi-Xin Zou Tsinghua Univeraity, China, Wende Tan Tsinghua University, China, Gang (Gary) Tan The Pennsylvania State University, University Park, USA
DOI