Collapsible contracts: fixing a pathology of gradual typing

The promise of gradual typing is that programmers should get the best of both worlds: the static guarantees of static types, and the dynamic flexibility of untyped programming. This is an enticing benefit, but one that, in practice, may carry significant costs. Significant enough, in fact, to threat...

Ausführliche Beschreibung

Gespeichert in:
Bibliographische Detailangaben
Veröffentlicht in:Proceedings of ACM on programming languages 2018-11, Vol.2 (OOPSLA), p.1-27
Hauptverfasser: Feltey, Daniel, Greenman, Ben, Scholliers, Christophe, Findler, Robert Bruce, St-Amour, Vincent
Format: Artikel
Sprache:eng
Online-Zugang:Volltext
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
container_end_page 27
container_issue OOPSLA
container_start_page 1
container_title Proceedings of ACM on programming languages
container_volume 2
creator Feltey, Daniel
Greenman, Ben
Scholliers, Christophe
Findler, Robert Bruce
St-Amour, Vincent
description The promise of gradual typing is that programmers should get the best of both worlds: the static guarantees of static types, and the dynamic flexibility of untyped programming. This is an enticing benefit, but one that, in practice, may carry significant costs. Significant enough, in fact, to threaten the very practicality of gradual typing; slowdowns as high as 120x are reported as arising from gradual typing. If one examines these results closely, though, it becomes clear that the costs of gradual typing are not evenly distributed. Indeed, while mixing typed and untyped code almost invariably carries non-trivial costs, many truly deal-breaking slowdowns exhibit pathological performance. Unfortunately, the very presence of these pathological cases---and therefore the possibility of hitting them during development---makes gradual typing a risky proposition in any setting that even remotely cares about performance. This work attacks one source of large overheads in these pathological cases: an accumulation of contract wrappers that perform redundant checks. The work introduces a novel strategy for contract checking---collapsible contracts---which eliminates this redundancy for function and vector contracts and drastically reduces the overhead of contract wrappers. We implemented this checking strategy as part of the Racket contract system, which is used in the Typed Racket gradual typing system. Our experiments show that our strategy successfully brings a class of pathological cases in line with normal cases, while not introducing an undue overhead to any of the other cases. Our results also show that the performance of gradual typing in Racket remains prohibitive for many programs, but that collapsible contracts are one essential ingredient in reducing the cost of gradual typing.
doi_str_mv 10.1145/3276503
format Article
fullrecord <record><control><sourceid>crossref</sourceid><recordid>TN_cdi_crossref_primary_10_1145_3276503</recordid><sourceformat>XML</sourceformat><sourcesystem>PC</sourcesystem><sourcerecordid>10_1145_3276503</sourcerecordid><originalsourceid>FETCH-LOGICAL-c2097-9108a739504e9e97efa7b54112bd019fac0ee8f067c2233966e8c69b61c1c8953</originalsourceid><addsrcrecordid>eNpNj01LAzEURYMoWGrxL2TnavS9fE50JYNWodBNXQ-ZNBlHYjMkIzj_3opduLoXLhzuIeQa4RZRyDvOtJLAz8iCCS0rFAzP__VLsirlAwDQcFFzsyAPTYrRjmXooqcuHaZs3VTuaRi-h0NPLR3t9J5i6meaAu2z3X_ZSKd5PK5X5CLYWPzqlEvy9vy0a16qzXb92jxuKsfA6Mog1FZzI0F44432wepOCkTW7Y9HgnXgfR1AaccY50YpXztlOoUOXW0kX5KbP67LqZTsQzvm4dPmuUVof7Xbkzb_AcwwSCk</addsrcrecordid><sourcetype>Aggregation Database</sourcetype><iscdi>true</iscdi><recordtype>article</recordtype></control><display><type>article</type><title>Collapsible contracts: fixing a pathology of gradual typing</title><source>ACM Digital Library Complete</source><source>Elektronische Zeitschriftenbibliothek - Frei zugängliche E-Journals</source><creator>Feltey, Daniel ; Greenman, Ben ; Scholliers, Christophe ; Findler, Robert Bruce ; St-Amour, Vincent</creator><creatorcontrib>Feltey, Daniel ; Greenman, Ben ; Scholliers, Christophe ; Findler, Robert Bruce ; St-Amour, Vincent</creatorcontrib><description>The promise of gradual typing is that programmers should get the best of both worlds: the static guarantees of static types, and the dynamic flexibility of untyped programming. This is an enticing benefit, but one that, in practice, may carry significant costs. Significant enough, in fact, to threaten the very practicality of gradual typing; slowdowns as high as 120x are reported as arising from gradual typing. If one examines these results closely, though, it becomes clear that the costs of gradual typing are not evenly distributed. Indeed, while mixing typed and untyped code almost invariably carries non-trivial costs, many truly deal-breaking slowdowns exhibit pathological performance. Unfortunately, the very presence of these pathological cases---and therefore the possibility of hitting them during development---makes gradual typing a risky proposition in any setting that even remotely cares about performance. This work attacks one source of large overheads in these pathological cases: an accumulation of contract wrappers that perform redundant checks. The work introduces a novel strategy for contract checking---collapsible contracts---which eliminates this redundancy for function and vector contracts and drastically reduces the overhead of contract wrappers. We implemented this checking strategy as part of the Racket contract system, which is used in the Typed Racket gradual typing system. Our experiments show that our strategy successfully brings a class of pathological cases in line with normal cases, while not introducing an undue overhead to any of the other cases. Our results also show that the performance of gradual typing in Racket remains prohibitive for many programs, but that collapsible contracts are one essential ingredient in reducing the cost of gradual typing.</description><identifier>ISSN: 2475-1421</identifier><identifier>EISSN: 2475-1421</identifier><identifier>DOI: 10.1145/3276503</identifier><language>eng</language><ispartof>Proceedings of ACM on programming languages, 2018-11, Vol.2 (OOPSLA), p.1-27</ispartof><lds50>peer_reviewed</lds50><oa>free_for_read</oa><woscitedreferencessubscribed>false</woscitedreferencessubscribed><citedby>FETCH-LOGICAL-c2097-9108a739504e9e97efa7b54112bd019fac0ee8f067c2233966e8c69b61c1c8953</citedby><cites>FETCH-LOGICAL-c2097-9108a739504e9e97efa7b54112bd019fac0ee8f067c2233966e8c69b61c1c8953</cites></display><links><openurl>$$Topenurl_article</openurl><openurlfulltext>$$Topenurlfull_article</openurlfulltext><thumbnail>$$Tsyndetics_thumb_exl</thumbnail><link.rule.ids>314,776,780,27901,27902</link.rule.ids></links><search><creatorcontrib>Feltey, Daniel</creatorcontrib><creatorcontrib>Greenman, Ben</creatorcontrib><creatorcontrib>Scholliers, Christophe</creatorcontrib><creatorcontrib>Findler, Robert Bruce</creatorcontrib><creatorcontrib>St-Amour, Vincent</creatorcontrib><title>Collapsible contracts: fixing a pathology of gradual typing</title><title>Proceedings of ACM on programming languages</title><description>The promise of gradual typing is that programmers should get the best of both worlds: the static guarantees of static types, and the dynamic flexibility of untyped programming. This is an enticing benefit, but one that, in practice, may carry significant costs. Significant enough, in fact, to threaten the very practicality of gradual typing; slowdowns as high as 120x are reported as arising from gradual typing. If one examines these results closely, though, it becomes clear that the costs of gradual typing are not evenly distributed. Indeed, while mixing typed and untyped code almost invariably carries non-trivial costs, many truly deal-breaking slowdowns exhibit pathological performance. Unfortunately, the very presence of these pathological cases---and therefore the possibility of hitting them during development---makes gradual typing a risky proposition in any setting that even remotely cares about performance. This work attacks one source of large overheads in these pathological cases: an accumulation of contract wrappers that perform redundant checks. The work introduces a novel strategy for contract checking---collapsible contracts---which eliminates this redundancy for function and vector contracts and drastically reduces the overhead of contract wrappers. We implemented this checking strategy as part of the Racket contract system, which is used in the Typed Racket gradual typing system. Our experiments show that our strategy successfully brings a class of pathological cases in line with normal cases, while not introducing an undue overhead to any of the other cases. Our results also show that the performance of gradual typing in Racket remains prohibitive for many programs, but that collapsible contracts are one essential ingredient in reducing the cost of gradual typing.</description><issn>2475-1421</issn><issn>2475-1421</issn><fulltext>true</fulltext><rsrctype>article</rsrctype><creationdate>2018</creationdate><recordtype>article</recordtype><recordid>eNpNj01LAzEURYMoWGrxL2TnavS9fE50JYNWodBNXQ-ZNBlHYjMkIzj_3opduLoXLhzuIeQa4RZRyDvOtJLAz8iCCS0rFAzP__VLsirlAwDQcFFzsyAPTYrRjmXooqcuHaZs3VTuaRi-h0NPLR3t9J5i6meaAu2z3X_ZSKd5PK5X5CLYWPzqlEvy9vy0a16qzXb92jxuKsfA6Mog1FZzI0F44432wepOCkTW7Y9HgnXgfR1AaccY50YpXztlOoUOXW0kX5KbP67LqZTsQzvm4dPmuUVof7Xbkzb_AcwwSCk</recordid><startdate>20181101</startdate><enddate>20181101</enddate><creator>Feltey, Daniel</creator><creator>Greenman, Ben</creator><creator>Scholliers, Christophe</creator><creator>Findler, Robert Bruce</creator><creator>St-Amour, Vincent</creator><scope>AAYXX</scope><scope>CITATION</scope></search><sort><creationdate>20181101</creationdate><title>Collapsible contracts: fixing a pathology of gradual typing</title><author>Feltey, Daniel ; Greenman, Ben ; Scholliers, Christophe ; Findler, Robert Bruce ; St-Amour, Vincent</author></sort><facets><frbrtype>5</frbrtype><frbrgroupid>cdi_FETCH-LOGICAL-c2097-9108a739504e9e97efa7b54112bd019fac0ee8f067c2233966e8c69b61c1c8953</frbrgroupid><rsrctype>articles</rsrctype><prefilter>articles</prefilter><language>eng</language><creationdate>2018</creationdate><toplevel>peer_reviewed</toplevel><toplevel>online_resources</toplevel><creatorcontrib>Feltey, Daniel</creatorcontrib><creatorcontrib>Greenman, Ben</creatorcontrib><creatorcontrib>Scholliers, Christophe</creatorcontrib><creatorcontrib>Findler, Robert Bruce</creatorcontrib><creatorcontrib>St-Amour, Vincent</creatorcontrib><collection>CrossRef</collection><jtitle>Proceedings of ACM on programming languages</jtitle></facets><delivery><delcategory>Remote Search Resource</delcategory><fulltext>fulltext</fulltext></delivery><addata><au>Feltey, Daniel</au><au>Greenman, Ben</au><au>Scholliers, Christophe</au><au>Findler, Robert Bruce</au><au>St-Amour, Vincent</au><format>journal</format><genre>article</genre><ristype>JOUR</ristype><atitle>Collapsible contracts: fixing a pathology of gradual typing</atitle><jtitle>Proceedings of ACM on programming languages</jtitle><date>2018-11-01</date><risdate>2018</risdate><volume>2</volume><issue>OOPSLA</issue><spage>1</spage><epage>27</epage><pages>1-27</pages><issn>2475-1421</issn><eissn>2475-1421</eissn><abstract>The promise of gradual typing is that programmers should get the best of both worlds: the static guarantees of static types, and the dynamic flexibility of untyped programming. This is an enticing benefit, but one that, in practice, may carry significant costs. Significant enough, in fact, to threaten the very practicality of gradual typing; slowdowns as high as 120x are reported as arising from gradual typing. If one examines these results closely, though, it becomes clear that the costs of gradual typing are not evenly distributed. Indeed, while mixing typed and untyped code almost invariably carries non-trivial costs, many truly deal-breaking slowdowns exhibit pathological performance. Unfortunately, the very presence of these pathological cases---and therefore the possibility of hitting them during development---makes gradual typing a risky proposition in any setting that even remotely cares about performance. This work attacks one source of large overheads in these pathological cases: an accumulation of contract wrappers that perform redundant checks. The work introduces a novel strategy for contract checking---collapsible contracts---which eliminates this redundancy for function and vector contracts and drastically reduces the overhead of contract wrappers. We implemented this checking strategy as part of the Racket contract system, which is used in the Typed Racket gradual typing system. Our experiments show that our strategy successfully brings a class of pathological cases in line with normal cases, while not introducing an undue overhead to any of the other cases. Our results also show that the performance of gradual typing in Racket remains prohibitive for many programs, but that collapsible contracts are one essential ingredient in reducing the cost of gradual typing.</abstract><doi>10.1145/3276503</doi><tpages>27</tpages><oa>free_for_read</oa></addata></record>
fulltext fulltext
identifier ISSN: 2475-1421
ispartof Proceedings of ACM on programming languages, 2018-11, Vol.2 (OOPSLA), p.1-27
issn 2475-1421
2475-1421
language eng
recordid cdi_crossref_primary_10_1145_3276503
source ACM Digital Library Complete; Elektronische Zeitschriftenbibliothek - Frei zugängliche E-Journals
title Collapsible contracts: fixing a pathology of gradual typing
url https://sfx.bib-bvb.de/sfx_tum?ctx_ver=Z39.88-2004&ctx_enc=info:ofi/enc:UTF-8&ctx_tim=2025-02-09T22%3A44%3A24IST&url_ver=Z39.88-2004&url_ctx_fmt=infofi/fmt:kev:mtx:ctx&rfr_id=info:sid/primo.exlibrisgroup.com:primo3-Article-crossref&rft_val_fmt=info:ofi/fmt:kev:mtx:journal&rft.genre=article&rft.atitle=Collapsible%20contracts:%20fixing%20a%20pathology%20of%20gradual%20typing&rft.jtitle=Proceedings%20of%20ACM%20on%20programming%20languages&rft.au=Feltey,%20Daniel&rft.date=2018-11-01&rft.volume=2&rft.issue=OOPSLA&rft.spage=1&rft.epage=27&rft.pages=1-27&rft.issn=2475-1421&rft.eissn=2475-1421&rft_id=info:doi/10.1145/3276503&rft_dat=%3Ccrossref%3E10_1145_3276503%3C/crossref%3E%3Curl%3E%3C/url%3E&disable_directlink=true&sfx.directlink=off&sfx.report_link=0&rft_id=info:oai/&rft_id=info:pmid/&rfr_iscdi=true