Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How heavy is reflection api  RSS feed

 
Kejal Shah
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How heavy is the reflection API in terms of speed and resources?

Tx
Kejal
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not an ORM question. Moving this to performance...
 
Eric Samson
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this question was also interesting in the context of ORM.
There are ORM tools based on reflection APIs and other based on different technics. And it could have an impact on the performance.

Ciao, Erix.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kejal Shah:

How heavy is the reflection API in terms of speed and resources?


Not heavy enough to typically worry about it.

In the context of ORM, for example, the actual access of the database will be likely *much* more heavy.
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer also varies with the JDK/JVM version (although I doubt it would ever swamp database and network cost). For old JVMs (1.0, 1.1) all forms of reflection were pretty expensive, but with each successive JVM Sun put more smarts into supporting reflection efficiently. These days I suspect its hardly worth even thinking about in most contexts, although I'll admit it has been awhile since I've seen any specific metrics quoted.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!