Conference paper Open Access

Optimization of Swift Protocols

Barik, Rajkishore; Sridharan, Manu; Ramanathan, Murali Krishna; Chabbi, Murali


MARC21 XML Export

<?xml version='1.0' encoding='UTF-8'?>
<record xmlns="http://www.loc.gov/MARC21/slim">
  <leader>00000nam##2200000uu#4500</leader>
  <datafield tag="041" ind1=" " ind2=" ">
    <subfield code="a">eng</subfield>
  </datafield>
  <controlfield tag="005">20200120165052.0</controlfield>
  <controlfield tag="001">3370076</controlfield>
  <datafield tag="700" ind1=" " ind2=" ">
    <subfield code="u">University of California, Riverside</subfield>
    <subfield code="a">Sridharan, Manu</subfield>
  </datafield>
  <datafield tag="700" ind1=" " ind2=" ">
    <subfield code="u">Uber Technologies Inc.</subfield>
    <subfield code="a">Ramanathan, Murali Krishna</subfield>
  </datafield>
  <datafield tag="700" ind1=" " ind2=" ">
    <subfield code="u">Uber Technologies Inc.</subfield>
    <subfield code="a">Chabbi, Murali</subfield>
  </datafield>
  <datafield tag="856" ind1="4" ind2=" ">
    <subfield code="s">12968</subfield>
    <subfield code="z">md5:3413ddf24646f10ded189fe26f42afb8</subfield>
    <subfield code="u">https://zenodo.org/record/3370076/files/benchmarks.tar.gz</subfield>
  </datafield>
  <datafield tag="856" ind1="4" ind2=" ">
    <subfield code="s">109946489</subfield>
    <subfield code="z">md5:85277307ed42d98760602bc6ef1ead54</subfield>
    <subfield code="u">https://zenodo.org/record/3370076/files/binary-swift-master-oopsla-submission.tar.gz</subfield>
  </datafield>
  <datafield tag="856" ind1="4" ind2=" ">
    <subfield code="s">109946489</subfield>
    <subfield code="z">md5:85277307ed42d98760602bc6ef1ead54</subfield>
    <subfield code="u">https://zenodo.org/record/3370076/files/binary.tar.gz</subfield>
  </datafield>
  <datafield tag="856" ind1="4" ind2=" ">
    <subfield code="s">5164</subfield>
    <subfield code="z">md5:74dedf86c0dc255b8c1febe3c38e8fca</subfield>
    <subfield code="u">https://zenodo.org/record/3370076/files/README.md</subfield>
  </datafield>
  <datafield tag="856" ind1="4" ind2=" ">
    <subfield code="s">2908815</subfield>
    <subfield code="z">md5:bafa7f271ab1ba462c9c78bfa1af6533</subfield>
    <subfield code="u">https://zenodo.org/record/3370076/files/sampleapp.tar.gz</subfield>
  </datafield>
  <datafield tag="856" ind1="4" ind2=" ">
    <subfield code="s">15743160</subfield>
    <subfield code="z">md5:89ece72568fa79beae2b7523028fea62</subfield>
    <subfield code="u">https://zenodo.org/record/3370076/files/swift-4.2-app-evaluation.tar.gz</subfield>
  </datafield>
  <datafield tag="856" ind1="4" ind2=" ">
    <subfield code="s">502947701</subfield>
    <subfield code="z">md5:28a369e65291de02c54ccb81a112e105</subfield>
    <subfield code="u">https://zenodo.org/record/3370076/files/swift-master-08052019.tar.gz</subfield>
  </datafield>
  <datafield tag="856" ind1="4" ind2=" ">
    <subfield code="s">681308229</subfield>
    <subfield code="z">md5:acd9f279060a99579665a28e2920030b</subfield>
    <subfield code="u">https://zenodo.org/record/3370076/files/swift-master-oopsla-submission.tar.gz</subfield>
  </datafield>
  <datafield tag="542" ind1=" " ind2=" ">
    <subfield code="l">open</subfield>
  </datafield>
  <datafield tag="260" ind1=" " ind2=" ">
    <subfield code="c">2019-08-12</subfield>
  </datafield>
  <datafield tag="909" ind1="C" ind2="O">
    <subfield code="p">openaire</subfield>
    <subfield code="o">oai:zenodo.org:3370076</subfield>
  </datafield>
  <datafield tag="100" ind1=" " ind2=" ">
    <subfield code="u">Uber Technologies Inc.</subfield>
    <subfield code="a">Barik, Rajkishore</subfield>
  </datafield>
  <datafield tag="245" ind1=" " ind2=" ">
    <subfield code="a">Optimization of Swift Protocols</subfield>
  </datafield>
  <datafield tag="540" ind1=" " ind2=" ">
    <subfield code="u">https://creativecommons.org/licenses/by/4.0/legalcode</subfield>
    <subfield code="a">Creative Commons Attribution 4.0 International</subfield>
  </datafield>
  <datafield tag="650" ind1="1" ind2="7">
    <subfield code="a">cc-by</subfield>
    <subfield code="2">opendefinition.org</subfield>
  </datafield>
  <datafield tag="520" ind1=" " ind2=" ">
    <subfield code="a">&lt;p&gt;Title:&amp;nbsp;Optimization of Swift Protocols&lt;/p&gt;

&lt;p&gt;Abstract:&lt;/p&gt;

&lt;p&gt;Swift, an increasingly-popular programming language, advocates the use of protocols, which define a set of required methods and properties for conforming types. &amp;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. &amp;nbsp;Unfortunately, heavy use of protocols can result in significant performance overhead. &amp;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.&lt;/p&gt;

&lt;p&gt;In this paper, we describe three new optimizations and transformations we have developed to reduce the overhead of Swift protocols. &amp;nbsp;Within a procedure, we define LocalVar, a data-flow analysis and transformation to remove both dynamic dispatch and boxing overheads. &amp;nbsp;We also describe Param, which optimizes the case of protocol-typed method parameters using specialization. &amp;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. &amp;nbsp;We also describe how these optimizations work fruitfully together and with existing Swift optimizations to deliver further speedups.&lt;/p&gt;

&lt;p&gt;We perform elaborate experimentation and demonstrate that our&amp;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.&lt;/p&gt;</subfield>
  </datafield>
  <datafield tag="773" ind1=" " ind2=" ">
    <subfield code="n">doi</subfield>
    <subfield code="i">isVersionOf</subfield>
    <subfield code="a">10.5281/zenodo.3366379</subfield>
  </datafield>
  <datafield tag="024" ind1=" " ind2=" ">
    <subfield code="a">10.5281/zenodo.3370076</subfield>
    <subfield code="2">doi</subfield>
  </datafield>
  <datafield tag="980" ind1=" " ind2=" ">
    <subfield code="a">publication</subfield>
    <subfield code="b">conferencepaper</subfield>
  </datafield>
</record>
190
130
views
downloads
All versions This version
Views 19057
Downloads 13030
Data volume 15.8 GB3.0 GB
Unique views 17355
Unique downloads 3410

Share

Cite as