Repr 类型:一个抽象概念统领一切

Viktor Palmkvist, Anders Ågren Thuné, Elias Castegren, David Broman
{"title":"Repr 类型:一个抽象概念统领一切","authors":"Viktor Palmkvist, Anders Ågren Thuné, Elias Castegren, David Broman","doi":"arxiv-2409.07950","DOIUrl":null,"url":null,"abstract":"The choice of how to represent an abstract type can have a major impact on\nthe performance of a program, yet mainstream compilers cannot perform\noptimizations at such a high level. When dealing with optimizations of data\ntype representations, an important feature is having extensible\nrepresentation-flexible data types; the ability for a programmer to add new\nabstract types and operations, as well as concrete implementations of these,\nwithout modifying the compiler or a previously defined library. Many research\nprojects support high-level optimizations through static analysis,\ninstrumentation, or benchmarking, but they are all restricted in at least one\naspect of extensibility. This paper presents a new approach to representation-flexible data types\nwithout such restrictions and which still finds efficient optimizations. Our\napproach centers around a single built-in type $\\texttt{repr}$ and function\noverloading with cost annotations for operation implementations. We evaluate\nour approach (i) by defining a universal collection type as a library, a single\ntype for all conventional collections, and (ii) by designing and implementing a\nrepresentation-flexible graph library. Programs using $\\texttt{repr}$ types are\ntypically faster than programs with idiomatic representation choices --\nsometimes dramatically so -- as long as the compiler finds good implementations\nfor all operations. Our compiler performs the analysis efficiently by finding\noptimized solutions quickly and by reusing previous results to avoid\nrecomputations.","PeriodicalId":501197,"journal":{"name":"arXiv - CS - Programming Languages","volume":"8 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2024-09-12","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Repr Types: One Abstraction to Rule Them All\",\"authors\":\"Viktor Palmkvist, Anders Ågren Thuné, Elias Castegren, David Broman\",\"doi\":\"arxiv-2409.07950\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"The choice of how to represent an abstract type can have a major impact on\\nthe performance of a program, yet mainstream compilers cannot perform\\noptimizations at such a high level. When dealing with optimizations of data\\ntype representations, an important feature is having extensible\\nrepresentation-flexible data types; the ability for a programmer to add new\\nabstract types and operations, as well as concrete implementations of these,\\nwithout modifying the compiler or a previously defined library. Many research\\nprojects support high-level optimizations through static analysis,\\ninstrumentation, or benchmarking, but they are all restricted in at least one\\naspect of extensibility. This paper presents a new approach to representation-flexible data types\\nwithout such restrictions and which still finds efficient optimizations. Our\\napproach centers around a single built-in type $\\\\texttt{repr}$ and function\\noverloading with cost annotations for operation implementations. We evaluate\\nour approach (i) by defining a universal collection type as a library, a single\\ntype for all conventional collections, and (ii) by designing and implementing a\\nrepresentation-flexible graph library. Programs using $\\\\texttt{repr}$ types are\\ntypically faster than programs with idiomatic representation choices --\\nsometimes dramatically so -- as long as the compiler finds good implementations\\nfor all operations. Our compiler performs the analysis efficiently by finding\\noptimized solutions quickly and by reusing previous results to avoid\\nrecomputations.\",\"PeriodicalId\":501197,\"journal\":{\"name\":\"arXiv - CS - Programming Languages\",\"volume\":\"8 1\",\"pages\":\"\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2024-09-12\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"arXiv - CS - Programming Languages\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/arxiv-2409.07950\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Programming Languages","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2409.07950","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

摘要

选择如何表示抽象类型会对程序的性能产生重大影响,但主流编译器无法在如此高的层次上进行优化。在处理数据类型表示法的优化问题时,一个重要的特点是具有可扩展的表示法--灵活的数据类型;程序员能够在不修改编译器或以前定义的库的情况下,添加新的抽象类型和操作,以及这些类型和操作的具体实现。许多研究项目通过静态分析、工具或基准测试支持高级优化,但它们至少在可扩展性的一个方面受到限制。本文提出了一种新的方法来处理表示灵活的数据类型,这种方法没有这些限制,但仍能找到高效的优化方法。我们的方法围绕单一内置类型 $texttt{repr}$,以及对操作实现进行代价注解的函数重载。我们评估了我们的方法:(i) 将通用集合类型定义为库,即所有常规集合的单一类型;(ii) 设计并实现了灵活的图库。只要编译器能为所有操作找到良好的实现,那么使用 $\texttt{repr}$ 类型的程序通常比使用惯用表示选择的程序更快,有时甚至快得惊人。我们的编译器通过快速找到优化方案和重复使用以前的结果来避免重新计算,从而高效地执行分析。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
查看原文
分享 分享
微信好友 朋友圈 QQ好友 复制链接
本刊更多论文
Repr Types: One Abstraction to Rule Them All
The choice of how to represent an abstract type can have a major impact on the performance of a program, yet mainstream compilers cannot perform optimizations at such a high level. When dealing with optimizations of data type representations, an important feature is having extensible representation-flexible data types; the ability for a programmer to add new abstract types and operations, as well as concrete implementations of these, without modifying the compiler or a previously defined library. Many research projects support high-level optimizations through static analysis, instrumentation, or benchmarking, but they are all restricted in at least one aspect of extensibility. This paper presents a new approach to representation-flexible data types without such restrictions and which still finds efficient optimizations. Our approach centers around a single built-in type $\texttt{repr}$ and function overloading with cost annotations for operation implementations. We evaluate our approach (i) by defining a universal collection type as a library, a single type for all conventional collections, and (ii) by designing and implementing a representation-flexible graph library. Programs using $\texttt{repr}$ types are typically faster than programs with idiomatic representation choices -- sometimes dramatically so -- as long as the compiler finds good implementations for all operations. Our compiler performs the analysis efficiently by finding optimized solutions quickly and by reusing previous results to avoid recomputations.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
期刊最新文献
Memory Consistency and Program Transformations No Saved Kaleidosope: an 100% Jitted Neural Network Coding Language with Pythonic Syntax Towards Quantum Multiparty Session Types The Incredible Shrinking Context... in a decompiler near you Scheme Pearl: Quantum Continuations
×
引用
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