A high-performance Java reflection library using bytecode generation for faster field, method, and constructor access.
ReflectASM is a high-performance Java reflection library that uses bytecode generation to provide fast access to fields, methods, and constructors. It solves the performance limitations of Java's built-in reflection by generating optimized access classes at runtime, making it ideal for applications requiring frequent reflective operations.
Java developers working on performance-sensitive applications, frameworks, or libraries that rely heavily on reflection, such as serialization libraries, dependency injection containers, or dynamic proxy systems.
Developers choose ReflectASM for its significant performance gains over standard Java reflection, cleaner stack traces, and minimal library size, enabling efficient reflective operations without the overhead of traditional reflection APIs.
High performance Java reflection
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks included in the README show ReflectASM is much faster than Java reflection for field access, method calls, and constructors, with charts demonstrating up to 10x improvements in some cases.
ReflectASM omits intermediate reflection layers in stack traces, making debugging easier, as shown in the README's comparison where InvocationTargetException clutter is removed.
Allows precomputed indices for methods and fields to eliminate name lookup overhead in loops, as demonstrated in the usage examples for repeated invocations.
The library is very small and integrates easily with tools like Maven, adding minimal dependencies, which is ideal for lightweight or performance-focused projects.
Accesses primitive fields directly via bytecode to prevent boxing overhead, enhancing efficiency for numeric or boolean operations, as mentioned in the overview.
Cannot access private members and relies on setAccessible for protected/package-private access, which may fail under security restrictions, reducing flexibility in secured environments.
Invoking code that throws checked exceptions requires catching Exception broadly, as noted in the README, which can lead to less precise error handling and potential bugs.
Generates access classes at runtime, adding initial setup cost and memory usage, which might not pay off for infrequent reflective operations or in short-lived applications.
Internally uses ASM for bytecode manipulation, which could introduce compatibility issues with future Java versions or require familiarity with low-level bytecode concepts.