Rust as a language for high performance GC implementation

Yi Lin, S. Blackburn, Antony Lloyd Hosking, Michael Norrish
{"title":"Rust as a language for high performance GC implementation","authors":"Yi Lin, S. Blackburn, Antony Lloyd Hosking, Michael Norrish","doi":"10.1145/2926697.2926707","DOIUrl":null,"url":null,"abstract":"High performance garbage collectors build upon performance-critical low-level code, typically exhibit multiple levels of concurrency, and are prone to subtle bugs. Implementing, debugging and maintaining such collectors can therefore be extremely challenging. The choice of implementation language is a crucial consideration when building a collector. Typically, the drive for performance and the need for efficient support of low-level memory operations leads to the use of low-level languages like C or C++, which offer little by way of safety and software engineering benefits. This risks undermining the robustness and flexibility of the collector design. Rust's ownership model, lifetime specification, and reference borrowing deliver safety guarantees through a powerful static checker with little runtime overhead. These features make Rust a compelling candidate for a collector implementation language, but they come with restrictions that threaten expressiveness and efficiency. We describe our experience implementing an Immix garbage collector in Rust and C. We discuss the benefits of Rust, the obstacles encountered, and how we overcame them. We show that our Immix implementation has almost identical performance on micro benchmarks, compared to its implementation in C, and outperforms the popular BDW collector on the gcbench micro benchmark. We find that Rust's safety features do not create significant barriers to implementing a high performance collector. Though memory managers are usually considered low-level, our high performance implementation relies on very little unsafe code, with the vast majority of the implementation benefiting from Rust's safety. We see our experience as a compelling proof-of-concept of Rust as an implementation language for high performance garbage collection.","PeriodicalId":203550,"journal":{"name":"Proceedings of the 2016 ACM SIGPLAN International Symposium on Memory Management","volume":"34 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2016-06-14","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"11","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 2016 ACM SIGPLAN International Symposium on Memory Management","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/2926697.2926707","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 11

Abstract

High performance garbage collectors build upon performance-critical low-level code, typically exhibit multiple levels of concurrency, and are prone to subtle bugs. Implementing, debugging and maintaining such collectors can therefore be extremely challenging. The choice of implementation language is a crucial consideration when building a collector. Typically, the drive for performance and the need for efficient support of low-level memory operations leads to the use of low-level languages like C or C++, which offer little by way of safety and software engineering benefits. This risks undermining the robustness and flexibility of the collector design. Rust's ownership model, lifetime specification, and reference borrowing deliver safety guarantees through a powerful static checker with little runtime overhead. These features make Rust a compelling candidate for a collector implementation language, but they come with restrictions that threaten expressiveness and efficiency. We describe our experience implementing an Immix garbage collector in Rust and C. We discuss the benefits of Rust, the obstacles encountered, and how we overcame them. We show that our Immix implementation has almost identical performance on micro benchmarks, compared to its implementation in C, and outperforms the popular BDW collector on the gcbench micro benchmark. We find that Rust's safety features do not create significant barriers to implementing a high performance collector. Though memory managers are usually considered low-level, our high performance implementation relies on very little unsafe code, with the vast majority of the implementation benefiting from Rust's safety. We see our experience as a compelling proof-of-concept of Rust as an implementation language for high performance garbage collection.
Rust作为实现高性能GC的语言
高性能垃圾收集器构建在对性能至关重要的低级代码之上,通常表现出多级并发性,并且容易出现细微的错误。因此,实现、调试和维护这样的收集器是极具挑战性的。在构建收集器时,实现语言的选择是一个关键的考虑因素。通常,对性能的追求和对底层内存操作的有效支持的需要导致使用像C或c++这样的底层语言,这些语言在安全性和软件工程方面提供的好处很少。这可能会破坏收集器设计的健壮性和灵活性。Rust的所有权模型、生命周期规范和引用借用通过一个功能强大的静态检查器提供了安全保证,并且运行时开销很小。这些特性使Rust成为收集器实现语言的有力候选者,但是它们附带的限制会威胁到表现力和效率。我们描述了我们在Rust和c中实现Immix垃圾收集器的经验。我们讨论了Rust的好处、遇到的障碍以及我们如何克服它们。我们表明,与使用C实现相比,我们的Immix实现在微基准测试上具有几乎相同的性能,并且在gchbench微基准测试上优于流行的BDW收集器。我们发现Rust的安全特性并没有对实现高性能收集器造成明显的障碍。虽然内存管理器通常被认为是底层的,但我们的高性能实现依赖于很少的不安全代码,绝大多数实现受益于Rust的安全性。我们把我们的经验看作是Rust作为高性能垃圾收集实现语言的一个令人信服的概念证明。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
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学术文献互助群
群 号:481959085
Book学术官方微信