Synthesizing Efficient Memoization Algorithms
-
Published:2023-10-16
Issue:OOPSLA2
Volume:7
Page:89-115
-
ISSN:2475-1421
-
Container-title:Proceedings of the ACM on Programming Languages
-
language:en
-
Short-container-title:Proc. ACM Program. Lang.
Author:
Sun Yican1ORCID,
Peng Xuanyu1ORCID,
Xiong Yingfei1ORCID
Affiliation:
1. Peking University, Beijing, China
Abstract
In this paper, we propose an automated approach to finding correct and efficient memoization algorithms from a given declarative specification. This problem has two major challenges: (i) a memoization algorithm is too large to be handled by conventional program synthesizers; (ii) we need to guarantee the efficiency of the memoization algorithm. To address this challenge, we structure the synthesis of memoization algorithms by introducing the local objective function and the memoization partition function and reduce the synthesis task to two smaller independent program synthesis tasks. Moreover, the number of distinct outputs of the function synthesized in the second synthesis task also decides the efficiency of the synthesized memoization algorithm, and we only need to minimize the number of different output values of the synthesized function. However, the generated synthesis task is still too complex for existing synthesizers. Thus, we propose a novel synthesis algorithm that combines the deductive and inductive methods to solve these tasks. To evaluate our algorithm, we collect 42 real-world benchmarks from Leetcode, the National Olympiad in Informatics in Provinces-Junior (a national-wide algorithmic programming contest in China), and previous approaches. Our approach successfully synhesizes 39/42 problems in a reasonable time, outperforming the baselines.
Funder
National Key Research and Development Program of China
National Natural Science Foundation of China
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Reference56 articles.
1. [n. d.]. Full version of this paper. https://boyvolcano.github.io/publication/oopsla-23/oopsla23.pdf [n. d.]. Full version of this paper. https://boyvolcano.github.io/publication/oopsla-23/oopsla23.pdf
2. [n. d.]. National Olympiad in Informatics in Provinces-Junior. https://noi.ccf.org.cn/zxzy/lnzl/index.shtml [n. d.]. National Olympiad in Informatics in Provinces-Junior. https://noi.ccf.org.cn/zxzy/lnzl/index.shtml
3. [n. d.]. The world’s leading online programming learning platform. https://leetcode.com/ [n. d.]. The world’s leading online programming learning platform. https://leetcode.com/
4. Selective memoization
5. Prolog Programming Language
Cited by
2 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. ASAC: A Benchmark for Algorithm Synthesis;Companion Proceedings of the 32nd ACM International Conference on the Foundations of Software Engineering;2024-07-10
2. From Batch to Stream: Automatic Generation of Online Algorithms;Proceedings of the ACM on Programming Languages;2024-06-20