Conference paper Open Access
Barik, Rajkishore; Sridharan, Manu; Ramanathan, Murali Krishna; Chabbi, Murali
<?xml version='1.0' encoding='utf-8'?> <resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" xsi:schemaLocation="http://datacite.org/schema/kernel-4 http://schema.datacite.org/meta/kernel-4.1/metadata.xsd"> <identifier identifierType="DOI">10.5281/zenodo.3370076</identifier> <creators> <creator> <creatorName>Barik, Rajkishore</creatorName> <givenName>Rajkishore</givenName> <familyName>Barik</familyName> <affiliation>Uber Technologies Inc.</affiliation> </creator> <creator> <creatorName>Sridharan, Manu</creatorName> <givenName>Manu</givenName> <familyName>Sridharan</familyName> <affiliation>University of California, Riverside</affiliation> </creator> <creator> <creatorName>Ramanathan, Murali Krishna</creatorName> <givenName>Murali Krishna</givenName> <familyName>Ramanathan</familyName> <affiliation>Uber Technologies Inc.</affiliation> </creator> <creator> <creatorName>Chabbi, Murali</creatorName> <givenName>Murali</givenName> <familyName>Chabbi</familyName> <affiliation>Uber Technologies Inc.</affiliation> </creator> </creators> <titles> <title>Optimization of Swift Protocols</title> </titles> <publisher>Zenodo</publisher> <publicationYear>2019</publicationYear> <dates> <date dateType="Issued">2019-08-12</date> </dates> <language>en</language> <resourceType resourceTypeGeneral="ConferencePaper"/> <alternateIdentifiers> <alternateIdentifier alternateIdentifierType="url">https://zenodo.org/record/3370076</alternateIdentifier> </alternateIdentifiers> <relatedIdentifiers> <relatedIdentifier relatedIdentifierType="DOI" relationType="IsVersionOf">10.5281/zenodo.3366379</relatedIdentifier> </relatedIdentifiers> <rightsList> <rights rightsURI="https://creativecommons.org/licenses/by/4.0/legalcode">Creative Commons Attribution 4.0 International</rights> <rights rightsURI="info:eu-repo/semantics/openAccess">Open Access</rights> </rightsList> <descriptions> <description descriptionType="Abstract"><p>Title:&nbsp;Optimization of Swift Protocols</p> <p>Abstract:</p> <p>Swift, an increasingly-popular programming language, advocates the use of protocols, which define a set of required methods and properties for conforming types. &nbsp;Protocols are commonly used in Swift programs for abstracting away implementation details; e.g., in an industrial app, they are heavily used to enable mock objects for unit testing. &nbsp;Unfortunately, heavy use of protocols can result in significant performance overhead. &nbsp;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.</p> <p>In this paper, we describe three new optimizations and transformations we have developed to reduce the overhead of Swift protocols. &nbsp;Within a procedure, we define LocalVar, a data-flow analysis and transformation to remove both dynamic dispatch and boxing overheads. &nbsp;We also describe Param, which optimizes the case of protocol-typed method parameters using specialization. &nbsp;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. &nbsp;We also describe how these optimizations work fruitfully together and with existing Swift optimizations to deliver further speedups.</p> <p>We perform elaborate experimentation and demonstrate that our&nbsp;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 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.</p></description> </descriptions> </resource>
All versions | This version | |
---|---|---|
Views | 190 | 57 |
Downloads | 130 | 30 |
Data volume | 15.8 GB | 3.0 GB |
Unique views | 173 | 55 |
Unique downloads | 34 | 10 |