In the last few years the interest in reflection has grown and many modern programming languages/environments (e.g., Java and. NET) have provided the programmer with reflective mechanisms, i.e., with the ability of dynamically looking into (introspect) the structure of the code from the code itself. In spite of its evident usefulness, reflection has many detractors, who claim that it is too inefficient to be used with real profit. In this work, we have investigated about the performance issue in the context of the Java reflection library and presented a different approach to the introspection in Java that improves its performances. The basic idea of the proposed approach consists of moving most of the overhead due to the dynamic introspection from run-time to compiletime. The efficiency improvement has been proved by providing a new reflection library compliant - that is, it provides exactly the same services -, with the standard Java reflection library based on the proposed approach. This paper is focused on speeding up the reification and the invocation of methods, i.e., on the class SmartMethod that replaces the class Method of the standard reflection library.

SmartReflection : efficient introspection in Java / W. Cazzola. - In: JOURNAL OF OBJECT TECHNOLOGY. - ISSN 1660-1769. - 3:11(2004), pp. 117-132. [10.5381/jot.2004.3.11.a6]

SmartReflection : efficient introspection in Java

W. Cazzola
Primo
2004

Abstract

In the last few years the interest in reflection has grown and many modern programming languages/environments (e.g., Java and. NET) have provided the programmer with reflective mechanisms, i.e., with the ability of dynamically looking into (introspect) the structure of the code from the code itself. In spite of its evident usefulness, reflection has many detractors, who claim that it is too inefficient to be used with real profit. In this work, we have investigated about the performance issue in the context of the Java reflection library and presented a different approach to the introspection in Java that improves its performances. The basic idea of the proposed approach consists of moving most of the overhead due to the dynamic introspection from run-time to compiletime. The efficiency improvement has been proved by providing a new reflection library compliant - that is, it provides exactly the same services -, with the standard Java reflection library based on the proposed approach. This paper is focused on speeding up the reification and the invocation of methods, i.e., on the class SmartMethod that replaces the class Method of the standard reflection library.
Introspection; Java; Java Reflection Library; Optimization; Reflection
Settore INF/01 - Informatica
Article (author)
File in questo prodotto:
File Dimensione Formato  
jot04-published.pdf

accesso aperto

Tipologia: Publisher's version/PDF
Dimensione 494.81 kB
Formato Adobe PDF
494.81 kB Adobe PDF Visualizza/Apri
Pubblicazioni consigliate

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/2434/10457
Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 8
  • ???jsp.display-item.citation.isi??? ND
social impact