Optimizing method search with lookup caches and incremental coloring

Pascal André, J. Royer
{"title":"Optimizing method search with lookup caches and incremental coloring","authors":"Pascal André, J. Royer","doi":"10.1145/141936.141947","DOIUrl":null,"url":null,"abstract":"An efficient mechanism for method lookup is csscntial in any reasonable implementation of a clussbased object-oriented language. One tcchniquc, static caches, provide constant time lookup, but consumes cxcessive memory. To alleviate the memory consumption problem many systems USC a coloring schcmc that allows cache rows to be shared and thus reduces the ovcrall cache size. This technique is easily implcmcntcd I’OI stongly typed languages such as C++ and Eiffcl, but not for languages such as CLOS or Smalltalk. This papct provides a solution to this latter problem: that of coloring for static caches in dynamically typed objcct-oricnted languages. Our solution is to use an incrcmcntal coloring algorithm to avoid the memory consumption problems of the naive approach. l-Introduction Object-oriented programming is an attractive programming sub-paradigm for many reasons, not the lcast of which are: polymorphism, encapsulation, mcssagc Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise, or to republish, requires a fee and/or specific permission. @ 1992 ACM 0-89791~539-9/92/OOlOlOl 10...$1.50 passing, inheritance, instantiation, and dynamic binding. Object-oriented programming provides interesting solutions to the problems of software quality through reusability, extensibility, and modularity [MEY 881. One of the key tenets of software engineering is execution efftciency. By Moon’s definition [MOO 861, execution efficiency consists of making good use of hardware resources, e.g., the processor, memory, communications, etc. Moon distinguishes four measures: the programmer’s time, CPU time, page fault rate, and virtual memory occupied. The last three features correspond to typical weaknesses in the implementation of object-oriented languages. Poor execution efficiency is the classic reason for users to deprecate systems such as Smalltalkand CLOS, and to embrace compiled, statically typed languages such as Eiffel and C++. One contribution to poor execution efficiency in languages such as Smalltalkand CLOS is the cost of method lookup. One way to reduce the cost of method lookup is to use a static lookup cache. Using such a cache provides the system with a constant time method lookup, independent of the inheritance hierarchy structurc and the method distribution. Unfortunately, these caches can consume large amounts of memory. One technique that is used to reduce this memory consumption is to use selector coloring to fold non-conflicting selectors into single cache entries [DIX 891. This technique has been implemented in a number of existing compiled languages, although the coloring time OOPSLA’92, pp. 1 lo126 and size of the conflict graph arc often prohibitive. Many situations lead to a large computational overhead (the coloring time) without resulting in signilicant bcncfits (less memory consumption). In this paper, we invcstigatc method lookup caches in languages that allow dynamic class modilications. These are object-oriented languages with: dynamic typing (e.g., Smalltalkor CLOS), dynamic binding (the method lookup is done at cxccution time). WC call languages with thcsc fcaturcs S-languages. Such languages are very attractive to programmer’s for a number of reasons, one of the most important being the ability to obscrvc the cffccts of a few local moditications without waiting for a Icngthy rc-compilation. In this paper WC show that Dixon’s algorithm [DIX 891 is not a good fit to &languages, and then WC propose a simple incremental version that colors the sclcctors in a reasonable time and number of colors, and without a large memory overhead. Section 2 of this paper covers the background: the major method lookup improvement tcchniqucs, and their cache utilization. It also discusses the basic Dixon coloring algorithm. Section 3 discusses the advantages of coloring when implcmcnting &languagcs. Section 4 summarizes our cxperimcnts with the Smalltalk-801 system that verify the thcorics from section 3. Finally, section 5 dcscribcs our incrcmcntal coloring and summarizcs its improved results on the same Smalltalksystem.","PeriodicalId":190766,"journal":{"name":"Conference proceedings on Object-oriented programming systems, languages, and applications","volume":"16 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"1992-10-31","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"62","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Conference proceedings on Object-oriented programming systems, languages, and applications","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/141936.141947","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 62

Abstract

An efficient mechanism for method lookup is csscntial in any reasonable implementation of a clussbased object-oriented language. One tcchniquc, static caches, provide constant time lookup, but consumes cxcessive memory. To alleviate the memory consumption problem many systems USC a coloring schcmc that allows cache rows to be shared and thus reduces the ovcrall cache size. This technique is easily implcmcntcd I’OI stongly typed languages such as C++ and Eiffcl, but not for languages such as CLOS or Smalltalk. This papct provides a solution to this latter problem: that of coloring for static caches in dynamically typed objcct-oricnted languages. Our solution is to use an incrcmcntal coloring algorithm to avoid the memory consumption problems of the naive approach. l-Introduction Object-oriented programming is an attractive programming sub-paradigm for many reasons, not the lcast of which are: polymorphism, encapsulation, mcssagc Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, the ACM copyright notice and the title of the publication and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery. To copy otherwise, or to republish, requires a fee and/or specific permission. @ 1992 ACM 0-89791~539-9/92/OOlOlOl 10...$1.50 passing, inheritance, instantiation, and dynamic binding. Object-oriented programming provides interesting solutions to the problems of software quality through reusability, extensibility, and modularity [MEY 881. One of the key tenets of software engineering is execution efftciency. By Moon’s definition [MOO 861, execution efficiency consists of making good use of hardware resources, e.g., the processor, memory, communications, etc. Moon distinguishes four measures: the programmer’s time, CPU time, page fault rate, and virtual memory occupied. The last three features correspond to typical weaknesses in the implementation of object-oriented languages. Poor execution efficiency is the classic reason for users to deprecate systems such as Smalltalkand CLOS, and to embrace compiled, statically typed languages such as Eiffel and C++. One contribution to poor execution efficiency in languages such as Smalltalkand CLOS is the cost of method lookup. One way to reduce the cost of method lookup is to use a static lookup cache. Using such a cache provides the system with a constant time method lookup, independent of the inheritance hierarchy structurc and the method distribution. Unfortunately, these caches can consume large amounts of memory. One technique that is used to reduce this memory consumption is to use selector coloring to fold non-conflicting selectors into single cache entries [DIX 891. This technique has been implemented in a number of existing compiled languages, although the coloring time OOPSLA’92, pp. 1 lo126 and size of the conflict graph arc often prohibitive. Many situations lead to a large computational overhead (the coloring time) without resulting in signilicant bcncfits (less memory consumption). In this paper, we invcstigatc method lookup caches in languages that allow dynamic class modilications. These are object-oriented languages with: dynamic typing (e.g., Smalltalkor CLOS), dynamic binding (the method lookup is done at cxccution time). WC call languages with thcsc fcaturcs S-languages. Such languages are very attractive to programmer’s for a number of reasons, one of the most important being the ability to obscrvc the cffccts of a few local moditications without waiting for a Icngthy rc-compilation. In this paper WC show that Dixon’s algorithm [DIX 891 is not a good fit to &languages, and then WC propose a simple incremental version that colors the sclcctors in a reasonable time and number of colors, and without a large memory overhead. Section 2 of this paper covers the background: the major method lookup improvement tcchniqucs, and their cache utilization. It also discusses the basic Dixon coloring algorithm. Section 3 discusses the advantages of coloring when implcmcnting &languagcs. Section 4 summarizes our cxperimcnts with the Smalltalk-801 system that verify the thcorics from section 3. Finally, section 5 dcscribcs our incrcmcntal coloring and summarizcs its improved results on the same Smalltalksystem.
优化方法搜索查找缓存和增量着色
在任何基于类的面向对象语言的合理实现中,有效的方法查找机制都是必不可少的。一种技术,静态缓存,提供恒定的时间查找,但消耗过多的内存。为了缓解内存消耗问题,许多系统使用了一种着色方案,允许共享缓存行,从而减少了总体缓存大小。这种技术在强类型语言(如c++和eiffel)中很容易实现,但在CLOS或Smalltalk等语言中则不然。本文提供了后一个问题的解决方案:在动态类型的面向对象语言中为静态缓存着色。我们的解决方案是使用增量着色算法来避免幼稚方法的内存消耗问题。面向对象编程是一种有吸引力的编程子范式,原因有很多,其中不包括:多态性、封装、mcssagc只要复制不是为了直接的商业利益而制作或分发,ACM版权声明、出版物标题和出版日期出现,并且声明复制是由计算机协会许可的,就允许免费复制全部或部分本材料。以其他方式复制或重新发布需要付费和/或特定许可。@ 1992 ACM 0-89791~539-9/92/OOlOlOl 10…$1.50传递,继承,实例化和动态绑定。面向对象编程通过可重用性、可扩展性和模块化为软件质量问题提供了有趣的解决方案[MEY 881]。软件工程的关键原则之一是执行效率。根据Moon的定义[MOO 861],执行效率包括对硬件资源的充分利用,如处理器、内存、通信等。Moon区分了四种度量:程序员时间、CPU时间、页面错误率和占用的虚拟内存。最后三个特性对应于面向对象语言实现中的典型弱点。低执行效率是用户弃用smalltalk和CLOS等系统,而采用Eiffel和c++等编译型静态类型语言的典型原因。导致smalltalk和CLOS等语言执行效率低下的一个原因是方法查找的成本。减少方法查找成本的一种方法是使用静态查找缓存。使用这样的缓存为系统提供了一个恒定时间的方法查找,独立于继承层次结构和方法分布。不幸的是,这些缓存会消耗大量内存。用于减少这种内存消耗的一种技术是使用选择器着色,将不冲突的选择器折叠成单个缓存项[DIX 891]。这种技术已经在许多现有的编译语言中实现,尽管着色时间OOPSLA ' 92, pp. 1 lo126和冲突图的大小通常令人望而却步。许多情况会导致大量的计算开销(着色时间),而不会产生显著的收益(更少的内存消耗)。在本文中,我们研究了允许动态类修改的语言中的方法查找缓存。这些面向对象语言具有:动态类型(例如Smalltalkor CLOS)、动态绑定(方法查找在执行时完成)。具有这些特性的WC调用语言。这类语言对程序员非常有吸引力,原因有很多,其中最重要的一个原因是能够消除一些局部修改的影响,而无需等待冗长的rc编译。在这篇论文中,WC证明了Dixon的算法[DIX 891]不太适合&languages,然后WC提出了一个简单的增量版本,可以在合理的时间和颜色数量内为分块上色,并且没有大量的内存开销。本文的第2节涵盖了背景:主要的方法查找改进技术,以及它们的缓存利用率。讨论了基本的Dixon着色算法。第3节讨论了在隐含&语言时着色的优点。第4节总结了我们在Smalltalk-801系统上的实验,验证了第3节中的理论。最后,第5节描述了我们的增量着色,并总结了它在同一个Smalltalksystem上的改进结果。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约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学术官方微信
小红书