Skip to main content

Optimization of Visitor Performance by Reflection-Based Analysis

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 6707))

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

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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)

    Google Scholar 

  2. Demakov, A.: TreeDL (2007), http://treedl.org/

  3. Gamma, E., et al.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison Wesley, Reading (1995)

    Google Scholar 

  4. Hill, J.H., Gokhale, A.: Using Generative Programming to Enhance Reuse in Visitor Pattern-based DSML Model Interpreters. Tech. rep. IEEE Trans. SP (2007)

    Google Scholar 

  5. Hughes, J.: The Design of a Pretty-printing Library. In: Advanced Functional Programming, pp. 53–96. Springer, Heidelberg (1995)

    Chapter  Google Scholar 

  6. Lämmel, R., Visser, E., Visser, J.: The Essence of Strategic Programming (2002)

    Google Scholar 

  7. Lieberherr, K.: Demeter: Aspect-Oriented Software Development, http://www.ccs.neu.edu/research/demeter/

  8. 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)

    Article  Google Scholar 

  9. Ovlinger, J., Wand, M.: A language for specifying recursive traversals of object structures”. In: ACM SIGPLAN Notices, vol. 34 (October 1999)

    Google Scholar 

  10. Palsberg, J., Jay, C.B.: The Essence of the Visitor Pattern (1997)

    Google Scholar 

  11. Schordan, M.: The Language of the Visitor Design Pattern. Journal of Universal Computer Science 12(7), 849–867 (2006)

    Google Scholar 

  12. Spivey, J.: The Z Notation: A Reference Manual. Prentice Hall, Englewood Cliffs (1988), http://spivey.oriel.ox.ac.uk/~mike/zrm/

    MATH  Google Scholar 

  13. van Drunen, T., Palsberg, J.: Visitor-oriented programming. In: Proc. FOOL-11 (2004)

    Google Scholar 

  14. Visser, J.: Visitor Combination and Traversal Control. In: Proc. OOPSLA 2001, pp. 270–282. ACM Press, New York (2001)

    Google Scholar 

  15. Trancón y Widemann, B., Lepper, M.: The BandM Meta-Tools User Documentation. (2010), http://bandm.eu/metatools/docs/usage/

  16. 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)

    Article  MATH  Google Scholar 

  17. 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)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics