Conference paper Open Access

Optimization of Swift Protocols

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


JSON Export

{
  "files": [
    {
      "links": {
        "self": "https://zenodo.org/api/files/6b2d1d9e-8235-4c1d-8a9d-b4338067fbd9/benchmarks.tar.gz"
      }, 
      "checksum": "md5:3413ddf24646f10ded189fe26f42afb8", 
      "bucket": "6b2d1d9e-8235-4c1d-8a9d-b4338067fbd9", 
      "key": "benchmarks.tar.gz", 
      "type": "gz", 
      "size": 12968
    }, 
    {
      "links": {
        "self": "https://zenodo.org/api/files/6b2d1d9e-8235-4c1d-8a9d-b4338067fbd9/binary-swift-master-oopsla-submission.tar.gz"
      }, 
      "checksum": "md5:85277307ed42d98760602bc6ef1ead54", 
      "bucket": "6b2d1d9e-8235-4c1d-8a9d-b4338067fbd9", 
      "key": "binary-swift-master-oopsla-submission.tar.gz", 
      "type": "gz", 
      "size": 109946489
    }, 
    {
      "links": {
        "self": "https://zenodo.org/api/files/6b2d1d9e-8235-4c1d-8a9d-b4338067fbd9/binary.tar.gz"
      }, 
      "checksum": "md5:85277307ed42d98760602bc6ef1ead54", 
      "bucket": "6b2d1d9e-8235-4c1d-8a9d-b4338067fbd9", 
      "key": "binary.tar.gz", 
      "type": "gz", 
      "size": 109946489
    }, 
    {
      "links": {
        "self": "https://zenodo.org/api/files/6b2d1d9e-8235-4c1d-8a9d-b4338067fbd9/README.md"
      }, 
      "checksum": "md5:74dedf86c0dc255b8c1febe3c38e8fca", 
      "bucket": "6b2d1d9e-8235-4c1d-8a9d-b4338067fbd9", 
      "key": "README.md", 
      "type": "md", 
      "size": 5164
    }, 
    {
      "links": {
        "self": "https://zenodo.org/api/files/6b2d1d9e-8235-4c1d-8a9d-b4338067fbd9/sampleapp.tar.gz"
      }, 
      "checksum": "md5:bafa7f271ab1ba462c9c78bfa1af6533", 
      "bucket": "6b2d1d9e-8235-4c1d-8a9d-b4338067fbd9", 
      "key": "sampleapp.tar.gz", 
      "type": "gz", 
      "size": 2908815
    }, 
    {
      "links": {
        "self": "https://zenodo.org/api/files/6b2d1d9e-8235-4c1d-8a9d-b4338067fbd9/swift-4.2-app-evaluation.tar.gz"
      }, 
      "checksum": "md5:89ece72568fa79beae2b7523028fea62", 
      "bucket": "6b2d1d9e-8235-4c1d-8a9d-b4338067fbd9", 
      "key": "swift-4.2-app-evaluation.tar.gz", 
      "type": "gz", 
      "size": 15743160
    }, 
    {
      "links": {
        "self": "https://zenodo.org/api/files/6b2d1d9e-8235-4c1d-8a9d-b4338067fbd9/swift-master-08052019.tar.gz"
      }, 
      "checksum": "md5:28a369e65291de02c54ccb81a112e105", 
      "bucket": "6b2d1d9e-8235-4c1d-8a9d-b4338067fbd9", 
      "key": "swift-master-08052019.tar.gz", 
      "type": "gz", 
      "size": 502947701
    }, 
    {
      "links": {
        "self": "https://zenodo.org/api/files/6b2d1d9e-8235-4c1d-8a9d-b4338067fbd9/swift-master-oopsla-submission.tar.gz"
      }, 
      "checksum": "md5:acd9f279060a99579665a28e2920030b", 
      "bucket": "6b2d1d9e-8235-4c1d-8a9d-b4338067fbd9", 
      "key": "swift-master-oopsla-submission.tar.gz", 
      "type": "gz", 
      "size": 681308229
    }
  ], 
  "owners": [
    74473
  ], 
  "doi": "10.5281/zenodo.3370076", 
  "stats": {
    "version_unique_downloads": 34.0, 
    "unique_views": 55.0, 
    "views": 57.0, 
    "version_views": 190.0, 
    "unique_downloads": 10.0, 
    "version_unique_views": 173.0, 
    "volume": 3008688549.0, 
    "version_downloads": 130.0, 
    "downloads": 30.0, 
    "version_volume": 15839064739.0
  }, 
  "links": {
    "doi": "https://doi.org/10.5281/zenodo.3370076", 
    "conceptdoi": "https://doi.org/10.5281/zenodo.3366379", 
    "bucket": "https://zenodo.org/api/files/6b2d1d9e-8235-4c1d-8a9d-b4338067fbd9", 
    "conceptbadge": "https://zenodo.org/badge/doi/10.5281/zenodo.3366379.svg", 
    "html": "https://zenodo.org/record/3370076", 
    "latest_html": "https://zenodo.org/record/3370076", 
    "badge": "https://zenodo.org/badge/doi/10.5281/zenodo.3370076.svg", 
    "latest": "https://zenodo.org/api/records/3370076"
  }, 
  "conceptdoi": "10.5281/zenodo.3366379", 
  "created": "2019-08-16T21:56:15.979439+00:00", 
  "updated": "2020-01-20T16:50:52.258387+00:00", 
  "conceptrecid": "3366379", 
  "revision": 4, 
  "id": 3370076, 
  "metadata": {
    "access_right_category": "success", 
    "doi": "10.5281/zenodo.3370076", 
    "description": "<p>Title:&nbsp;Optimization of Swift Protocols</p>\n\n<p>Abstract:</p>\n\n<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>\n\n<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>\n\n<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>", 
    "language": "eng", 
    "title": "Optimization of Swift Protocols", 
    "license": {
      "id": "CC-BY-4.0"
    }, 
    "relations": {
      "version": [
        {
          "count": 3, 
          "index": 2, 
          "parent": {
            "pid_type": "recid", 
            "pid_value": "3366379"
          }, 
          "is_last": true, 
          "last_child": {
            "pid_type": "recid", 
            "pid_value": "3370076"
          }
        }
      ]
    }, 
    "publication_date": "2019-08-12", 
    "creators": [
      {
        "affiliation": "Uber Technologies Inc.", 
        "name": "Barik, Rajkishore"
      }, 
      {
        "affiliation": "University of California, Riverside", 
        "name": "Sridharan, Manu"
      }, 
      {
        "affiliation": "Uber Technologies Inc.", 
        "name": "Ramanathan, Murali Krishna"
      }, 
      {
        "affiliation": "Uber Technologies Inc.", 
        "name": "Chabbi, Murali"
      }
    ], 
    "access_right": "open", 
    "resource_type": {
      "subtype": "conferencepaper", 
      "type": "publication", 
      "title": "Conference paper"
    }, 
    "related_identifiers": [
      {
        "scheme": "doi", 
        "identifier": "10.5281/zenodo.3366379", 
        "relation": "isVersionOf"
      }
    ]
  }
}
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