Announcement Announcement Module
Collapse
No announcement yet.
Performance of dependency injection Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Performance of dependency injection

    Gday,

    I'm fairly new to Spring (used Spring for a bit in my app). One thing that I noticed is that the app runs faster without the dependency injection (i.e. without Spring).

    Is this a normal behaviour? Or is this just a misconfiguration in my Spring?
    Spring is great, but I just want to know if there are any performance impacts towards the application.


    Regards,


    Alex.

  • #2
    The overhead should be approximately the overhead incurred due to the usage of reflection (plus type conversion).
    However, due to the fact that IoC is mostly used for configuration, that should normally not be a big issue.

    So the questions are: How do you use Spring inside your application and how did you measure the timing?

    Regards,
    Andreas

    Comment


    • #3
      Originally posted by netzone_tech
      Gday,

      I'm fairly new to Spring (used Spring for a bit in my app). One thing that I noticed is that the app runs faster without the dependency injection (i.e. without Spring).
      How many objects are you creating in Spring? Most objects I create in Spring are 'singletons', so only one instance is required and they are wired up in the beginning. So they only thing that causes overheads is the AOP stuff. But in most cases the communication with the outside world is much slower (your db transactions). So they would be an order of magnitude slower.

      Is this a normal behaviour? Or is this just a misconfiguration in my Spring?
      Spring is great, but I just want to know if there are any performance impacts towards the application.
      Can you tell more about your system because we don't have enough information to see what is the cause of the problem.

      Comment


      • #4
        Originally posted by netzone_tech
        I'm fairly new to Spring (used Spring for a bit in my app). One thing that I noticed is that the app runs faster without the dependency injection (i.e. without Spring).
        Can you define "faster", milliseconds, seconds etc.

        Originally posted by netzone_tech
        Is this a normal behaviour? Or is this just a misconfiguration in my Spring?
        Spring is great, but I just want to know if there are any performance impacts towards the application.
        How large is your spring context etc.? Also, quite often the perceived delay is actually in objects being created, so if you were to instantiate all the same objects manually; it would take the same time...the "spring overhead" is actually very small.

        Can you provide some figures please...

        Comment

        Working...
        X