Efficient dynamic dispatching, with type slicing

被引:4
|
作者
Yossi Gil, Joseph [1 ]
Zibin, Yoav [1 ]
机构
[1] Technion Israel Inst Technol, IL-32000 Haifa, Israel
来源
ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS | 2008年 / 30卷 / 01期
关键词
algorithms; design; measurement; performance; theory; CT (compact dispatch tables); dispatch; dynamic-typing; hierarchy; incremental; message; subtyping; type slicing;
D O I
10.1145/1290520.1290525
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
A fundamental problem in the implementation of object-oriented languages is that of a frugal implementation of dynamic dispatching, that is, a small footprint data structure that supports quick response to runtime dispatching queries of the following format: which method should be executed in response to a certain message sent to a given object. Previous theoretical algorithms for this problem tend to be impractical due to their conceptual complexity and large hidden constants. In contrast, successful practical heuristics lack theoretical support. The contribution of this article is in a novel type slicing technique, which results in two dispatching schemes: TS and CTd. We make the case for these schemes both practically and theoretically. The empirical findings on a corpus of 35 hierarchies totaling some 64 thousand types from eight different languages, demonstrate improvement over previous results in terms of the space required for the representation, and the time required for computing it. The theoretical analysis is with respect to iota, the best possible compression factor of the dispatching matrix. The results are expressed as a function of a parameter kappa, which can be thought of as a metric of the complexity of the topology of a multiple inheritance hierarchy. In single inheritance hierarchies kappa = 1, but although kappa can be in the order of the size of the hierarchy, it is typically a small constant in actual use of inheritance; in our corpus, the median value of kappa is 5, while its average is 6.4. The TS scheme generalizes the famous interval containment technique to multiple inheritance. TS achieves a compression factor of iota/kappa, that is, our generalization comes with an increase to the space requirement by a small factor of kappa. The pay is in the dispatching time, which is no longer constant as in a naive matrix implementation, but logarithmic in the number of different method implementations. In practice, dispatching uses one indirect branch and, on average, only 2.5 binary branches. The CT schemes are a sequence of algorithms CT1, CT2, CT3,..., where CTd uses d memory dereferencing operations during dispatch, and achieves a compression factor of 1/d iota(1-1/d) in a single inheritance setting. A generalization of these algorithms to a multiple inheritance setting, increases the space by a factor of (2 kappa)(1-1/d). This trade-off represents the first bounds on the compression ratio of constant-time dispatching algorithms. We also present an incremental variant of the CTd suited for languages such as Java.
引用
收藏
页数:53
相关论文
共 50 条
  • [31] HBD: Towards Efficient Reactive Rule Dispatching in Software-Defined Networks
    Chen, Chang
    Hu, Xiaohe
    Zheng, Kai
    Wang, Xiang
    Xiang, Yang
    Li, Jun
    TSINGHUA SCIENCE AND TECHNOLOGY, 2016, 21 (02) : 196 - 209
  • [32] HBD: Towards Efficient Reactive Rule Dispatching in Software-Defined Networks
    Chang Chen
    Xiaohe Hu
    Kai Zheng
    Xiang Wang
    Yang Xiang
    Jun Li
    TsinghuaScienceandTechnology, 2016, 21 (02) : 196 - 209
  • [33] Universal and efficient hybrid modeling and direct slicing method for additive manufacturing processes
    Wang, Sen-Lin
    Zhang, Li-Chao
    Cai, Chao
    Tang, Ming-Kai
    Chen, Si
    Huang, Jiang
    Shi, Yu-Sheng
    ADVANCES IN MANUFACTURING, 2024, 12 (02) : 300 - 316
  • [34] Toward Evolving Dispatching Rules for Dynamic Job Shop Scheduling Under Uncertainty
    Karunakaran, Deepak
    Mei, Yi
    Chen, Gang
    Zhang, Mengjie
    PROCEEDINGS OF THE 2017 GENETIC AND EVOLUTIONARY COMPUTATION CONFERENCE (GECCO'17), 2017, : 282 - 289
  • [35] Time-slicing high dynamic range 3D imaging
    Li, Fanfei
    Zhang, Shaohui
    Li, Lusong
    Xia, Chenxu
    Sun, Jiankun
    Hao, Qun
    OPTICS EXPRESS, 2023, 31 (18) : 29813 - 29825
  • [36] A Comparative Study of Dispatching Rule Representations in Evolutionary Algorithms for the Dynamic Unrelated Machines Environment
    Planinic, Lucija
    Backovic, Hrvoje
    Durasevic, Marko
    Jakobovic, Domagoj
    IEEE ACCESS, 2022, 10 : 22886 - 22901
  • [37] Optimization, Dispatching Rules and Hyper-heuristics: A Comparison in Dynamic Single Machine Scheduling
    Su Nguyen
    IECON 2017 - 43RD ANNUAL CONFERENCE OF THE IEEE INDUSTRIAL ELECTRONICS SOCIETY, 2017, : 4796 - 4801
  • [38] AN EFFICIENT DYNAMIC MECHANISM
    Athey, Susan
    Segal, Ilya
    ECONOMETRICA, 2013, 81 (06) : 2463 - 2485
  • [39] Effective and interpretable dispatching rules for dynamic job shops via guided empirical learning
    Ferreira, Cristiane
    Figueira, Goncalo
    Amorim, Pedro
    OMEGA-INTERNATIONAL JOURNAL OF MANAGEMENT SCIENCE, 2022, 111
  • [40] Research on Uncertain and Nonlinear Dynamic Weapons Dispatching System Using Fuzzy Robust Control
    Xia, Guoqing
    Luan, Tiantian
    Sun, Mingxiao
    2016 12TH INTERNATIONAL CONFERENCE ON NATURAL COMPUTATION, FUZZY SYSTEMS AND KNOWLEDGE DISCOVERY (ICNC-FSKD), 2016, : 1038 - 1043