Erlang虚拟机中保留术语共享的研究

N. Papaspyrou, Konstantinos Sagonas
{"title":"Erlang虚拟机中保留术语共享的研究","authors":"N. Papaspyrou, Konstantinos Sagonas","doi":"10.1145/2364489.2364493","DOIUrl":null,"url":null,"abstract":"In programming language implementations, one of the most important design decisions concerns the underlying representation of terms. In functional languages with immutable terms, the runtime system can choose to preserve sharing of subterms or destroy sharing and expand terms to their flattened representation during certain key operations. Both options have pros and cons. The implementation of Erlang in the Erlang/OTP system from Ericsson has so far opted for an implementation where sharing of subterms is not preserved when terms are copied (e.g., when sent from one process to another or when used as arguments in spawns).\n In this paper we describe our experiences and argue through examples why flattening terms during copying is not a good idea for a language like Erlang. More importantly, we propose a sharing-preserving copying mechanism for Erlang/OTP and describe a publicly available complete implementation of this mechanism. Performance results show that, even in extreme cases where no subterms are shared, this implementation has a reasonable overhead which is negligible in practice. In cases where shared subterms do exist, perhaps accidentally, the performance savings can be substantial.","PeriodicalId":140676,"journal":{"name":"Erlang Workshop","volume":"20 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2012-09-14","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"6","resultStr":"{\"title\":\"On preserving term sharing in the Erlang virtual machine\",\"authors\":\"N. Papaspyrou, Konstantinos Sagonas\",\"doi\":\"10.1145/2364489.2364493\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"In programming language implementations, one of the most important design decisions concerns the underlying representation of terms. In functional languages with immutable terms, the runtime system can choose to preserve sharing of subterms or destroy sharing and expand terms to their flattened representation during certain key operations. Both options have pros and cons. The implementation of Erlang in the Erlang/OTP system from Ericsson has so far opted for an implementation where sharing of subterms is not preserved when terms are copied (e.g., when sent from one process to another or when used as arguments in spawns).\\n In this paper we describe our experiences and argue through examples why flattening terms during copying is not a good idea for a language like Erlang. More importantly, we propose a sharing-preserving copying mechanism for Erlang/OTP and describe a publicly available complete implementation of this mechanism. Performance results show that, even in extreme cases where no subterms are shared, this implementation has a reasonable overhead which is negligible in practice. In cases where shared subterms do exist, perhaps accidentally, the performance savings can be substantial.\",\"PeriodicalId\":140676,\"journal\":{\"name\":\"Erlang Workshop\",\"volume\":\"20 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2012-09-14\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"6\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Erlang Workshop\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1145/2364489.2364493\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Erlang Workshop","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/2364489.2364493","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 6

摘要

在编程语言实现中,最重要的设计决策之一涉及术语的底层表示。在具有不可变术语的函数式语言中,运行时系统可以选择保留子术语的共享或在某些关键操作期间破坏共享并将术语扩展为其扁平表示。这两种选择各有利弊。爱立信的Erlang/OTP系统中Erlang的实现迄今为止选择了这样一种实现,即当术语被复制时(例如,当从一个进程发送到另一个进程时,或者当在spawn中用作参数时),子术语的共享不会被保留。在本文中,我们描述了我们的经验,并通过实例论证了为什么在复制过程中扁平化术语对于像Erlang这样的语言来说不是一个好主意。更重要的是,我们为Erlang/OTP提出了一种共享-保存复制机制,并描述了该机制的一个公开可用的完整实现。性能结果表明,即使在没有共享子项的极端情况下,该实现也有一个合理的开销,在实践中可以忽略不计。在确实存在共享子术语的情况下(可能是偶然的),性能节省可能是巨大的。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
On preserving term sharing in the Erlang virtual machine
In programming language implementations, one of the most important design decisions concerns the underlying representation of terms. In functional languages with immutable terms, the runtime system can choose to preserve sharing of subterms or destroy sharing and expand terms to their flattened representation during certain key operations. Both options have pros and cons. The implementation of Erlang in the Erlang/OTP system from Ericsson has so far opted for an implementation where sharing of subterms is not preserved when terms are copied (e.g., when sent from one process to another or when used as arguments in spawns). In this paper we describe our experiences and argue through examples why flattening terms during copying is not a good idea for a language like Erlang. More importantly, we propose a sharing-preserving copying mechanism for Erlang/OTP and describe a publicly available complete implementation of this mechanism. Performance results show that, even in extreme cases where no subterms are shared, this implementation has a reasonable overhead which is negligible in practice. In cases where shared subterms do exist, perhaps accidentally, the performance savings can be substantial.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信