Memoization of methods using software transactional memory to track internal state dependencies

Hugo Rito, João P. Cachopo
{"title":"Memoization of methods using software transactional memory to track internal state dependencies","authors":"Hugo Rito, João P. Cachopo","doi":"10.1145/1852761.1852775","DOIUrl":null,"url":null,"abstract":"Memoization is a well-known technique for improving the performance of a program, but it has been confined mostly to functional programming, where no mutable state or side-effects exist.\n Most object-oriented programs, however, are built around objects with an internal state that is mutable over the course of the program. Therefore, the execution of methods often depends on the internal state of some objects or produces side-effects, thus making the application of memoization impractical for object-oriented programs in general.\n In this paper, we propose an extended memoization approach that builds on the support provided by a Software Transactional Memory (STM) to identify both internal state dependencies and side-effects, hence removing many of the limitations of traditional memoization.\n We describe the Automatic Transaction-Oriented Memoization (ATOM) system, a thread-safe implementation of our memoization model that requires minimal learning effort from programmers, while offering a simple and customizable interface.\n Additionally, we describe a memoization advisory system that collects per-method performance statistics with the ultimate goal of aiding programmers in their task of choosing which methods are profitable to memoize.\n We argue that ATOM is the first memoization system adequate to the unique characteristics of object-oriented programs and we show how memoization can be implemented almost for free in systems that use an STM, presenting the reasons why this synergy can be particularly useful in transactional contexts.\n We show the usefulness of memoizing object-oriented programs by applying memoization to the STMBench7 benchmark, a standard benchmark developed for evaluating STM> implementations. The memoized version of the benchmark shows up to a 14-fold increase in the throughput for a read-dominated workload.","PeriodicalId":169989,"journal":{"name":"Principles and Practice of Programming in Java","volume":"15 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2010-09-15","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"22","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Principles and Practice of Programming in Java","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/1852761.1852775","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 22

Abstract

Memoization is a well-known technique for improving the performance of a program, but it has been confined mostly to functional programming, where no mutable state or side-effects exist. Most object-oriented programs, however, are built around objects with an internal state that is mutable over the course of the program. Therefore, the execution of methods often depends on the internal state of some objects or produces side-effects, thus making the application of memoization impractical for object-oriented programs in general. In this paper, we propose an extended memoization approach that builds on the support provided by a Software Transactional Memory (STM) to identify both internal state dependencies and side-effects, hence removing many of the limitations of traditional memoization. We describe the Automatic Transaction-Oriented Memoization (ATOM) system, a thread-safe implementation of our memoization model that requires minimal learning effort from programmers, while offering a simple and customizable interface. Additionally, we describe a memoization advisory system that collects per-method performance statistics with the ultimate goal of aiding programmers in their task of choosing which methods are profitable to memoize. We argue that ATOM is the first memoization system adequate to the unique characteristics of object-oriented programs and we show how memoization can be implemented almost for free in systems that use an STM, presenting the reasons why this synergy can be particularly useful in transactional contexts. We show the usefulness of memoizing object-oriented programs by applying memoization to the STMBench7 benchmark, a standard benchmark developed for evaluating STM> implementations. The memoized version of the benchmark shows up to a 14-fold increase in the throughput for a read-dominated workload.
使用软件事务性内存跟踪内部状态依赖关系的方法记忆
记忆是一种众所周知的提高程序性能的技术,但它主要局限于没有可变状态或副作用的函数式编程。然而,大多数面向对象的程序都是围绕具有内部状态的对象构建的,该内部状态在程序的整个过程中是可变的。因此,方法的执行常常依赖于某些对象的内部状态或产生副作用,从而使记忆的应用在一般的面向对象程序中变得不切实际。在本文中,我们提出了一种扩展的记忆方法,该方法基于软件事务性内存(STM)提供的支持来识别内部状态依赖和副作用,从而消除了传统记忆的许多限制。我们描述了自动面向事务的记忆(Automatic Transaction-Oriented Memoization, ATOM)系统,这是我们的记忆模型的一个线程安全实现,它只需要程序员进行最少的学习,同时提供了一个简单且可定制的接口。此外,我们描述了一个记忆咨询系统,该系统收集每个方法的性能统计数据,其最终目标是帮助程序员选择哪些方法值得记忆。我们认为ATOM是第一个适合于面向对象程序的独特特性的记忆系统,我们展示了如何在使用STM的系统中几乎免费地实现记忆,并说明了为什么这种协同作用在事务上下文中特别有用。我们通过将记忆法应用于STMBench7基准(一个为评估STM>实现而开发的标准基准)来展示记忆面向对象程序的有用性。记忆版本的基准测试显示,对于以读为主的工作负载,吞吐量提高了14倍。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约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学术文献互助群
群 号:604180095
Book学术官方微信