gpt4 book ai didi

Java 程序特化 - 它是什么?我不明白

转载 作者:行者123 更新时间:2023-12-01 05:57:12 25 4
gpt4 key购买 nike

我正在阅读有关程序特化的内容 - 特别是 java,说实话,我认为我不太理解它。到目前为止我的理解是它是一种通过约束参数或输入来优化程序效率的方法?实际上是如何做到的?有人可以向我解释一下它有什么帮助,或者举例说明它实际上做了什么以及如何完成?

谢谢

我一直在阅读:

Program Specialization - java

最佳答案

程序专门化是当您提前知道您将拥有的参数是什么时专门化程序的过程。

一个例子是,如果您有一个测试,并且您知道根据您的参数,您永远不会进入该 block ,那么您可以消除该测试。

您为某种输入创建了程序的专用版本。

基本上,它有助于摆脱你输入的无用内容。然而,使用现代架构和编译器(至少在 C 语言中),您不会在性能方面获得太多优势。

来自同一作者,我会推荐 Tempo 作品。

编辑

来自 Toplas 论文:

Program specialization is a program transformation technique that optimizes a pro- gram fragment with respect to information about a context in which it is used, by generating an implementation dedicated to this usage context. One approach to automatic program specialization is partial evaluation, which performs aggressive inter-procedural constant propagation of values of all data types, and performs constant folding and control-flow simplifications based on this information [Jones et al. 1993]. Partial evaluation thus adapts a program to known (static) informa- tion about its execution context, as supplied by the user (the programmer). Only the program parts controlled by unknown (dynamic) data are reconstructed. Par- tial evaluation has been extensively investigated for functional languages [Bondorf 1990; Consel 1993], logic languages [Lloyd and Shepherdson 1991], and imperative languages [Andersen 1994; Baier et al. 1994; Consel et al. 1996].

关于Java 程序特化 - 它是什么?我不明白,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2548128/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com