Computing Reviews

Metamorphic Programming:Unconventional High
Maurer P. Computer37(3):30-38,2004.Type:Article
Date Reviewed: 01/07/05

This paper presents a nonconventional technique for optimizing the performance of certain classes of programs. The technique, in brief, is to alter objects’ behavior by changing function pointers (typically, in the vtable) rather than by setting and repeatedly checking state variables. The paper also sketchily proposes some changes to C++-like programming languages to make this technique more palatable: the current usage relies on unchecked computed gotos.

Maurer claims that this “metamorphic” programming technique can make programs run five to 60 percent faster. Certainly (although not stated by the author), this is only possible for programs that spend most of their time in tight loops that involve a dispatch or similar decision process.

The main example in the paper is of a state-machine implementation of very large-scale integration (VLSI) simulation. I imagine this technique would also be valuable in an interpreter’s main decode/dispatch loop.

The metamorphic technique appears sound, and the paper is a pleasant, easy read, but I remain somewhat unsatisfied. I would have preferred more discussion of several key points: the relationship to the threaded interpreters, tail-recursion optimization, and other similar classical techniques; numeric presentation of performance improvement for more than one sample program; the option of achieving much of the same performance increase via compiler optimizations, rather than language changes; a description of the class of programs for which performance improvement is expected; and a discussion of the code maintenance and readability impact of this technique.

In general, I would be hesitant to adopt this technique without seeing a more careful analysis, and a better comparison with the existing alternatives.

Reviewer:  David Goldfarb Review #: CR130625 (0506-0672)

Reproduction in whole or in part without permission is prohibited.   Copyright 2024 ComputingReviews.com™
Terms of Use
| Privacy Policy