Characterizing the Usage and Performance Impact of Java Reflection: An Empirical Study

Reflection enables programs to dynamically inspect and manipulate their own structure, providing flexibility in evolving runtime environments. Java offers this capability through its Reflection API, which supports dynamic object creation, field access, method invocation, and metadata inspection. Despite these advantages, reflection complicates static analysis and may introduce runtime overhead, motivating a comprehensive empirical investigation of its practical use and cost. We analyze reflection usage across 59.4 million Java files from all open-source Java repositories on GitHub, reporting primitive-level statistics. Our results show that reflection is widely adopted but typically confined to specific components, with type retrieval and name inspection dominating usage, while advanced features such as behavioral reflection and generic type inspection also appear in a non-negligible number of repositories. We further measure execution-time and memory overhead across five major JVM implementations on Windows and Linux, considering single-threaded and multithreaded scenarios, and distinguishing startup from steady-state performance under JIT optimization. The results identify clear cost tiers among reflection primitives, substantial steady-state and JVM-dependent overheads, preserved parallel scalability despite high absolute costs, and potentially dramatic slowdowns when reflection is applied pervasively.

Authors

Institutions

Publication Details

Journal
ACM Transactions on Software Engineering and Methodology
Published
2026-05-21
DOI
https://doi.org/10.1145/3815583
Primary Topic
Software Engineering Research
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

Characterizing the Usage and Performance Impact of Java Reflection: An Empirical Study

Francisco Ortín, Miguel García
ACM Transactions on Software Engineering and Methodology
Software Engineering Research
article

Characterizing the Usage and Performance Impact of Java Reflection: An Empirical Study

Francisco Ortín, Miguel García
article en

Abstract

Reflection enables programs to dynamically inspect and manipulate their own structure, providing flexibility in evolving runtime environments. Java offers this capability through its Reflection API, which supports dynamic object creation, field access, method invocation, and metadata inspection. Despite these advantages, reflection complicates static analysis and may introduce runtime overhead, motivating a comprehensive empirical investigation of its practical use and cost. We analyze reflection usage across 59.4 million Java files from all open-source Java repositories on GitHub, reporting primitive-level statistics. Our results show that reflection is widely adopted but typically confined to specific components, with type retrieval and name inspection dominating usage, while advanced features such as behavioral reflection and generic type inspection also appear in a non-negligible number of repositories. We further measure execution-time and memory overhead across five major JVM implementations on Windows and Linux, considering single-threaded and multithreaded scenarios, and distinguishing startup from steady-state performance under JIT optimization. The results identify clear cost tiers among reflection primitives, substantial steady-state and JVM-dependent overheads, preserved parallel scalability despite high absolute costs, and potentially dramatic slowdowns when reflection is applied pervasively.

ACM Transactions on Software Engineering and Methodology
Universidad de Oviedo (ES), Munster Technological University (IE), Technological University Dublin (IE)
Openalex Percentile: Top 2%
Software Engineering Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.