Abstract
Visitors are a well-known and powerful design pattern for processing regular data structures and for combining declarative and imperative coding styles. The authors’ umod model generator creates Java data models from a concise and algebraic notation. It is primarily used to model intermediate representations of computer languages. The user defines visitor code by extending skeleton classes, which are generated according to traversal annotations in the model. Since the generated code on its own executes the pure traversal and no semantic side-effects, traversals are redundant unless some user-overridden method is eventually invoked. We present a reflection-based control flow analysis to detect this situation and prune the traversal transparently. With a well-stratified model, this may lead to substantial increase in performance.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Buchlovsky, P., Thielecke, H.: A Type-theoretic Reconstruction of the Visitor Pattern. In: Mathematical Foundations of Programming Semantics (MFPS 2005). ENTCS, vol. 155. Elsevier, Amsterdam (2006)
Demakov, A.: TreeDL (2007), http://treedl.org/
Gamma, E., et al.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison Wesley, Reading (1995)
Hill, J.H., Gokhale, A.: Using Generative Programming to Enhance Reuse in Visitor Pattern-based DSML Model Interpreters. Tech. rep. IEEE Trans. SP (2007)
Hughes, J.: The Design of a Pretty-printing Library. In: Advanced Functional Programming, pp. 53–96. Springer, Heidelberg (1995)
Lämmel, R., Visser, E., Visser, J.: The Essence of Strategic Programming (2002)
Lieberherr, K.: Demeter: Aspect-Oriented Software Development, http://www.ccs.neu.edu/research/demeter/
Lieberherr, K., Patt-Shamir, B., Orleans, D.: Traversals of object structures: Specification and Efficient Implementation. ACM Trans. Program. Lang. Syst. 26(2), 370–412 (2004)
Ovlinger, J., Wand, M.: A language for specifying recursive traversals of object structures”. In: ACM SIGPLAN Notices, vol. 34 (October 1999)
Palsberg, J., Jay, C.B.: The Essence of the Visitor Pattern (1997)
Schordan, M.: The Language of the Visitor Design Pattern. Journal of Universal Computer Science 12(7), 849–867 (2006)
Spivey, J.: The Z Notation: A Reference Manual. Prentice Hall, Englewood Cliffs (1988), http://spivey.oriel.ox.ac.uk/~mike/zrm/
van Drunen, T., Palsberg, J.: Visitor-oriented programming. In: Proc. FOOL-11 (2004)
Visser, J.: Visitor Combination and Traversal Control. In: Proc. OOPSLA 2001, pp. 270–282. ACM Press, New York (2001)
Trancón y Widemann, B., Lepper, M.: The BandM Meta-Tools User Documentation. (2010), http://bandm.eu/metatools/docs/usage/
Trancón y Widemann, B., Lepper, M., Wieland, J.: Automatic Construction of XML-based Tools seen as Meta-programming. Automated Software Engineering 10(1), 23–38 (2003)
Trancón y Widemann, B., Parnas, D.L.: Tabular Expressions and Total Functional Programming. In: IFL 2007 Revised Selected Papers, pp. 219–236. Springer, Heidelberg (2008)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2011 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Lepper, M., Trancón y Widemann, B. (2011). Optimization of Visitor Performance by Reflection-Based Analysis. In: Cabot, J., Visser, E. (eds) Theory and Practice of Model Transformations. ICMT 2011. Lecture Notes in Computer Science, vol 6707. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-21732-6_2
Download citation
DOI: https://doi.org/10.1007/978-3-642-21732-6_2
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-21731-9
Online ISBN: 978-3-642-21732-6
eBook Packages: Computer ScienceComputer Science (R0)