Efficient compilation of tail calls and continuations to JavaScript

Eric Thivierge, M. Feeley
{"title":"Efficient compilation of tail calls and continuations to JavaScript","authors":"Eric Thivierge, M. Feeley","doi":"10.1145/2661103.2661108","DOIUrl":null,"url":null,"abstract":"This paper describes an approach for compiling Scheme's tail calls and first-class continuations to JavaScript, a dynamic language without those features. Our approach is based on the use of a simple custom virtual machine intermediate representation that is translated to JavaScript. We compare this approach, which is used by the Gambit-JS compiler, to the Replay-C algorithm, used by Scheme2JS (a derivative of Bigloo), and Cheney on the MTA, used by Spock (a derivative of Chicken). We analyse the performance of the three systems with a set of benchmark programs on recent versions of four popular JavaScript VMs (V8, SpiderMonkey, Nitro and Chakra). On the benchmark programs, all systems perform best when executed with V8 and our approach is consistently faster than the others on all VMs. For some VMs and benchmarks our approach is moderately faster than the others (below a factor of 2), but in some cases there is a very large performance gap (with Nitro there is a slowdown of up to 3 orders of magnitude for Scheme2JS, and up to 2 orders of magnitude for Spock).","PeriodicalId":113092,"journal":{"name":"Scheme and Functional Programming","volume":"41 Suppl 1 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2012-09-09","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"3","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Scheme and Functional Programming","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/2661103.2661108","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 3

Abstract

This paper describes an approach for compiling Scheme's tail calls and first-class continuations to JavaScript, a dynamic language without those features. Our approach is based on the use of a simple custom virtual machine intermediate representation that is translated to JavaScript. We compare this approach, which is used by the Gambit-JS compiler, to the Replay-C algorithm, used by Scheme2JS (a derivative of Bigloo), and Cheney on the MTA, used by Spock (a derivative of Chicken). We analyse the performance of the three systems with a set of benchmark programs on recent versions of four popular JavaScript VMs (V8, SpiderMonkey, Nitro and Chakra). On the benchmark programs, all systems perform best when executed with V8 and our approach is consistently faster than the others on all VMs. For some VMs and benchmarks our approach is moderately faster than the others (below a factor of 2), but in some cases there is a very large performance gap (with Nitro there is a slowdown of up to 3 orders of magnitude for Scheme2JS, and up to 2 orders of magnitude for Spock).
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
有效地编译尾部调用和JavaScript的延续
本文描述了一种将Scheme的尾部调用和一级延续编译到JavaScript的方法,JavaScript是一种没有这些特性的动态语言。我们的方法是基于使用一个简单的自定义虚拟机中间表示,它被翻译成JavaScript。我们将Gambit-JS编译器使用的这种方法与Scheme2JS (Bigloo的衍生物)和MTA上的Cheney (Spock (Chicken的衍生物))使用的Replay-C算法进行比较。我们在四个流行的JavaScript虚拟机(V8, SpiderMonkey, Nitro和Chakra)的最新版本上使用一组基准程序分析了这三个系统的性能。在基准测试程序中,所有系统在使用V8时都表现最佳,并且我们的方法在所有vm上始终比其他方法更快。对于一些虚拟机和基准测试,我们的方法比其他方法要快一些(低于2倍),但在某些情况下,性能差距非常大(使用Nitro时,Scheme2JS的速度下降了3个数量级,而Spock的速度下降了2个数量级)。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
miniKanren, live and untagged: quine generation via relational interpreters (programming pearl) Efficient compilation of tail calls and continuations to JavaScript Optimizing JavaScript code for V8 Interpretations of the gradually-typed lambda calculus Scheme on the web and in the classroom: a retrospective about the LAML project
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
现在去查看 取消
×
提示
确定
0
微信
客服QQ
Book学术公众号 扫码关注我们
反馈
×
意见反馈
请填写您的意见或建议
请填写您的手机或邮箱
已复制链接
已复制链接
快去分享给好友吧!
我知道了
×
扫码分享
扫码分享
Book学术官方微信
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术
文献互助 智能选刊 最新文献 互助须知 联系我们:info@booksci.cn
Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。
Copyright © 2023 Book学术 All rights reserved.
ghs 京公网安备 11010802042870号 京ICP备2023020795号-1