Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8929839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:45:35+00:00 2026-06-15T08:45:35+00:00

I know that reflection is bit slow as all checks/validations are performed at run

  • 0

I know that reflection is bit slow as all checks/validations are performed at run time.

Suppose i am instantiating a class using reflection and calling method on it. So my question is will the invocation be always slow ( even if its 1% slower than normal case) or only for the first time ? Assume that this class is part of my web application which gets called multiple times.

Another angle to my confusion is that now most of the modern JVMs use JIT compilers. So will not the JVM try to optimize the subsequent invocations.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:45:36+00:00Added an answer on June 15, 2026 at 8:45 am

    Yes, the invocation will always be slow. The JIT-compiler optimizes the Java bytecode and compiles it to native code; it does not memoize or otherwise cache the results of methods, and calling into the reflection API means calling methods. The compiled native code will still call into the runtime’s reflection facility on every invocation, and that is what is slow.

    It will always be much slower to invoke a method using reflection than invoking it directly. However, note that the method’s body will execute at normal speed — it is only the process of invoking the method that will be slow.

    As always, profile your code. If the instantiation and method invocation via reflection turn out to be bottlenecks, then optimize accordingly. (For example, if the invoked method is querying a database then that action is most likely to be your bottleneck, and the overhead introduced by reflection is very unlikely to be a problem.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I came to know that using Reflection we can create objects without using new
I want to know that how the methods are invoked using Reflection in c#
I know that in GWT the java reflection tools isn't emulated, but is there
We know that behind the scenes, the ASP.NET MVC framework will use reflection to
I am using Reflection against the following class: class Constant { const CONSTANT =
I know that you can use reflection in Java to get the name of
So I've run into a bit of an issue. I know of a solution
I know that we can access private constructor via reflection as @Sanjay T. Sharma
I know that Phonegap has an event for back button, but it's only available
I know that this sort of question has been asked here before, but still

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.