You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Ivan Bojer <Iv...@citrix.com> on 2009/03/13 05:47:20 UTC

Java reflection performance

Ibatis documentation states that there is performance gain if one uses resultmaps instead of letting Ibatis figure out class mapping on its own. I could not find any more info about why is this a case!? Can anyone elaborate on this? Is this because reflection is slow in general?

Re: Java reflection performance

Posted by Ivan Bojer <Iv...@citrix.com>.
What if I do not have performance problem and just want to educate myself prior to system design (which is what we were discussing here)?
I agree with your assessment in some different context.

________________________________
From: Kengkaj Sathianpantarit <ke...@gmail.com>
Date: Fri, 13 Mar 2009 11:35:01 -0700
To: Ivan Bojer <Iv...@citrix.com>, IBatis <us...@ibatis.apache.org>
Subject: Re: Java reflection performance

I recommend that if you have performance problem, find the root cause
first, find what makes your application slow, then fix it, maybe by
rewriting algorithms, using batch processing.

You need to prove what the problem is first, there is no use to
optimize iBATIS, if the main problem is in somewhere else.

Kengkaj

On 3/13/09, Ivan Bojer <Iv...@citrix.com> wrote:
> I am really trying to understand performance issues. I agree with you that
> real-time apps will suffer, but if I am writing a controller for a get plane
> I would not use any O/R mapping tool obviously. You really want to run on
> bare metal there.
>
> So, real-time app definition is quite fuzzy and I personally think that it
> is quite ambiguous term. Back to my question, we are actually working on
> network policy appliance (think layer 7 packet switching). Can this qualify
> as  close to a real-time application. It depends if you ask network guy or
> the application guy :)
>
> I think that we are close enough to worry about performance and to be
> diligent to do anything that can speed up any layer of application (short of
> going directly into assembly code :) ).
>
> This is the reason why I asked the question. If someone can tell me that
> writing result maps will give me 10%,20%,30% performance improvement that
> will tell me something. Beside all of this I am really just curious from the
> geekness factor on why is there a difference.
>
> Thank you for your answer.
>
>
> From: Kengkaj Sathianpantarit <ke...@gmail.com>
> Reply-To: IBatis <us...@ibatis.apache.org>
> Date: Fri, 13 Mar 2009 06:35:03 -0700
> To: IBatis <us...@ibatis.apache.org>
> Subject: Re: Java reflection performance
>
> By realtime applications, I just mean applications that the timing is really
> important.
> From your example, for retrieving an account balance, the system slowdown
> sometimes for 10 seconds is bad, but there is nobody dies or losses big
> benefit because of it.
> But for jet fighters, it's a different story.
>
> This is an off-topic, if you want discuss further, please discuss with me
> via e-mail.
>
> Best Regards,
> Kengkaj
>
> On Fri, Mar 13, 2009 at 8:16 PM, Chris O'Connell
> <oc...@gorillachicago.com> wrote:
> I'm curious what you mean by 'realtime application'.  Not trying to be
> confrontational, but do you mean like the difference between writing
> controls for a jet fighter vs. retrieving an account balance?  I've always
> thought they were both 'realtime'.  Just a difference in semantics, I'm
> sure, but I am curious what you mean.
>
> Thanks,
> Chris
>
>
> On Fri, Mar 13, 2009 at 1:21 AM, Kengkaj Sathianpantarit
> <ke...@gmail.com> wrote:
> It is "slower", because it has more things to do, but if you're not
> implementing realtime application, this should not be an issue.
>
> Kengkaj
>
>
> On Fri, Mar 13, 2009 at 11:47 AM, Ivan Bojer <Iv...@citrix.com> wrote:
> Ibatis documentation states that there is performance gain if one uses
> resultmaps instead of letting Ibatis figure out class mapping on its own. I
> could not find any more info about why is this a case!? Can anyone elaborate
> on this? Is this because reflection is slow in general?
>
>
>
>
> --
> --
> Chris O'Connell
> Application Developer
> Gorilla
> 312.243.8777 x19
>
>
>
>


Re: Java reflection performance

Posted by Kengkaj Sathianpantarit <ke...@gmail.com>.
I recommend that if you have performance problem, find the root cause
first, find what makes your application slow, then fix it, maybe by
rewriting algorithms, using batch processing.

You need to prove what the problem is first, there is no use to
optimize iBATIS, if the main problem is in somewhere else.

Kengkaj

On 3/13/09, Ivan Bojer <Iv...@citrix.com> wrote:
> I am really trying to understand performance issues. I agree with you that
> real-time apps will suffer, but if I am writing a controller for a get plane
> I would not use any O/R mapping tool obviously. You really want to run on
> bare metal there.
>
> So, real-time app definition is quite fuzzy and I personally think that it
> is quite ambiguous term. Back to my question, we are actually working on
> network policy appliance (think layer 7 packet switching). Can this qualify
> as  close to a real-time application. It depends if you ask network guy or
> the application guy :)
>
> I think that we are close enough to worry about performance and to be
> diligent to do anything that can speed up any layer of application (short of
> going directly into assembly code :) ).
>
> This is the reason why I asked the question. If someone can tell me that
> writing result maps will give me 10%,20%,30% performance improvement that
> will tell me something. Beside all of this I am really just curious from the
> geekness factor on why is there a difference.
>
> Thank you for your answer.
>
>
> From: Kengkaj Sathianpantarit <ke...@gmail.com>
> Reply-To: IBatis <us...@ibatis.apache.org>
> Date: Fri, 13 Mar 2009 06:35:03 -0700
> To: IBatis <us...@ibatis.apache.org>
> Subject: Re: Java reflection performance
>
> By realtime applications, I just mean applications that the timing is really
> important.
> From your example, for retrieving an account balance, the system slowdown
> sometimes for 10 seconds is bad, but there is nobody dies or losses big
> benefit because of it.
> But for jet fighters, it's a different story.
>
> This is an off-topic, if you want discuss further, please discuss with me
> via e-mail.
>
> Best Regards,
> Kengkaj
>
> On Fri, Mar 13, 2009 at 8:16 PM, Chris O'Connell
> <oc...@gorillachicago.com> wrote:
> I'm curious what you mean by 'realtime application'.  Not trying to be
> confrontational, but do you mean like the difference between writing
> controls for a jet fighter vs. retrieving an account balance?  I've always
> thought they were both 'realtime'.  Just a difference in semantics, I'm
> sure, but I am curious what you mean.
>
> Thanks,
> Chris
>
>
> On Fri, Mar 13, 2009 at 1:21 AM, Kengkaj Sathianpantarit
> <ke...@gmail.com> wrote:
> It is "slower", because it has more things to do, but if you're not
> implementing realtime application, this should not be an issue.
>
> Kengkaj
>
>
> On Fri, Mar 13, 2009 at 11:47 AM, Ivan Bojer <Iv...@citrix.com> wrote:
> Ibatis documentation states that there is performance gain if one uses
> resultmaps instead of letting Ibatis figure out class mapping on its own. I
> could not find any more info about why is this a case!? Can anyone elaborate
> on this? Is this because reflection is slow in general?
>
>
>
>
> --
> --
> Chris O'Connell
> Application Developer
> Gorilla
> 312.243.8777 x19
>
>
>
>

Re: Java reflection performance

Posted by Clinton Begin <cl...@gmail.com>.
I recommend:

  * Write the code you're worried about.
  * Test it.
  * If it's fast enough, don't worry about it.
  * If it's not, return to the first step and try something else.

Technical spikes answer questions in a more relevant way than general
discussion.

Clinton

On Fri, Mar 13, 2009 at 10:46 AM, Ivan Bojer <Iv...@citrix.com> wrote:

>  I am really trying to understand performance issues. I agree with you
> that real-time apps will suffer, but if I am writing a controller for a get
> plane I would not use any O/R mapping tool obviously. You really want to run
> on bare metal there.
>
> So, real-time app definition is quite fuzzy and I personally think that it
> is quite ambiguous term. Back to my question, we are actually working on
> network policy appliance (think layer 7 packet switching). Can this qualify
> as  close to a real-time application. It depends if you ask network guy or
> the application guy :)
>
> I think that we are close enough to worry about performance and to be
> diligent to do anything that can speed up any layer of application (short of
> going directly into assembly code :) ).
>
> This is the reason why I asked the question. If someone can tell me that
> writing result maps will give me 10%,20%,30% performance improvement that
> will tell me something. Beside all of this I am really just curious from the
> geekness factor on why is there a difference.
>
> Thank you for your answer.
>
>
> *From: *Kengkaj Sathianpantarit <ke...@gmail.com>
> *Reply-To: *IBatis <us...@ibatis.apache.org>
> *Date: *Fri, 13 Mar 2009 06:35:03 -0700
> *To: *IBatis <us...@ibatis.apache.org>
> *Subject: *Re: Java reflection performance
>
>
> By realtime applications, I just mean applications that the timing is
> really important.
> From your example, for retrieving an account balance, the system slowdown
> sometimes for 10 seconds is bad, but there is nobody dies or losses big
> benefit because of it.
> But for jet fighters, it's a different story.
>
> This is an off-topic, if you want discuss further, please discuss with me
> via e-mail.
>
> Best Regards,
> Kengkaj
>
> On Fri, Mar 13, 2009 at 8:16 PM, Chris O'Connell <
> oconnell@gorillachicago.com> wrote:
>
> I'm curious what you mean by 'realtime application'.  Not trying to be
> confrontational, but do you mean like the difference between writing
> controls for a jet fighter vs. retrieving an account balance?  I've always
> thought they were both 'realtime'.  Just a difference in semantics, I'm
> sure, but I am curious what you mean.
>
> Thanks,
> Chris
>
>
> On Fri, Mar 13, 2009 at 1:21 AM, Kengkaj Sathianpantarit <
> kengkaj.s@gmail.com> wrote:
>
> It is "slower", because it has more things to do, but if you're not
> implementing realtime application, this should not be an issue.
>
> Kengkaj
>
>
> On Fri, Mar 13, 2009 at 11:47 AM, Ivan Bojer <Iv...@citrix.com>
> wrote:
>
> Ibatis documentation states that there is performance gain if one uses
> resultmaps instead of letting Ibatis figure out class mapping on its own. I
> could not find any more info about why is this a case!? Can anyone elaborate
> on this? Is this because reflection is slow in general?
>
>
>
>
>
> --
> --
> Chris O'Connell
> Application Developer
> Gorilla
> 312.243.8777 x19
>
>
>
>

Re: Java reflection performance

Posted by Ivan Bojer <Iv...@citrix.com>.
I am really trying to understand performance issues. I agree with you that real-time apps will suffer, but if I am writing a controller for a get plane I would not use any O/R mapping tool obviously. You really want to run on bare metal there.

So, real-time app definition is quite fuzzy and I personally think that it is quite ambiguous term. Back to my question, we are actually working on network policy appliance (think layer 7 packet switching). Can this qualify as  close to a real-time application. It depends if you ask network guy or the application guy :)

I think that we are close enough to worry about performance and to be diligent to do anything that can speed up any layer of application (short of going directly into assembly code :) ).

This is the reason why I asked the question. If someone can tell me that writing result maps will give me 10%,20%,30% performance improvement that will tell me something. Beside all of this I am really just curious from the geekness factor on why is there a difference.

Thank you for your answer.


From: Kengkaj Sathianpantarit <ke...@gmail.com>
Reply-To: IBatis <us...@ibatis.apache.org>
Date: Fri, 13 Mar 2009 06:35:03 -0700
To: IBatis <us...@ibatis.apache.org>
Subject: Re: Java reflection performance

By realtime applications, I just mean applications that the timing is really important.
>From your example, for retrieving an account balance, the system slowdown sometimes for 10 seconds is bad, but there is nobody dies or losses big benefit because of it.
But for jet fighters, it's a different story.

This is an off-topic, if you want discuss further, please discuss with me via e-mail.

Best Regards,
Kengkaj

On Fri, Mar 13, 2009 at 8:16 PM, Chris O'Connell <oc...@gorillachicago.com> wrote:
I'm curious what you mean by 'realtime application'.  Not trying to be confrontational, but do you mean like the difference between writing controls for a jet fighter vs. retrieving an account balance?  I've always thought they were both 'realtime'.  Just a difference in semantics, I'm sure, but I am curious what you mean.

Thanks,
Chris


On Fri, Mar 13, 2009 at 1:21 AM, Kengkaj Sathianpantarit <ke...@gmail.com> wrote:
It is "slower", because it has more things to do, but if you're not implementing realtime application, this should not be an issue.

Kengkaj


On Fri, Mar 13, 2009 at 11:47 AM, Ivan Bojer <Iv...@citrix.com> wrote:
Ibatis documentation states that there is performance gain if one uses resultmaps instead of letting Ibatis figure out class mapping on its own. I could not find any more info about why is this a case!? Can anyone elaborate on this? Is this because reflection is slow in general?




--
--
Chris O'Connell
Application Developer
Gorilla
312.243.8777 x19




Re: Java reflection performance

Posted by Kengkaj Sathianpantarit <ke...@gmail.com>.
By realtime applications, I just mean applications that the timing is really
important.
>From your example, for retrieving an account balance, the system slowdown
sometimes for 10 seconds is bad, but there is nobody dies or losses big
benefit because of it.
But for jet fighters, it's a different story.

This is an off-topic, if you want discuss further, please discuss with me
via e-mail.

Best Regards,
Kengkaj

On Fri, Mar 13, 2009 at 8:16 PM, Chris O'Connell <
oconnell@gorillachicago.com> wrote:

> I'm curious what you mean by 'realtime application'.  Not trying to be
> confrontational, but do you mean like the difference between writing
> controls for a jet fighter vs. retrieving an account balance?  I've always
> thought they were both 'realtime'.  Just a difference in semantics, I'm
> sure, but I am curious what you mean.
>
> Thanks,
> Chris
>
>
> On Fri, Mar 13, 2009 at 1:21 AM, Kengkaj Sathianpantarit <
> kengkaj.s@gmail.com> wrote:
>
>> It is "slower", because it has more things to do, but if you're not
>> implementing realtime application, this should not be an issue.
>>
>> Kengkaj
>>
>>
>> On Fri, Mar 13, 2009 at 11:47 AM, Ivan Bojer <Iv...@citrix.com>wrote:
>>
>>>  Ibatis documentation states that there is performance gain if one uses
>>> resultmaps instead of letting Ibatis figure out class mapping on its own. I
>>> could not find any more info about why is this a case!? Can anyone elaborate
>>> on this? Is this because reflection is slow in general?
>>>
>>
>>
>
>
> --
> --
> Chris O'Connell
> Application Developer
> Gorilla
> 312.243.8777 x19
>
>

Re: Java reflection performance

Posted by Chris O'Connell <oc...@gorillachicago.com>.
I'm curious what you mean by 'realtime application'.  Not trying to be
confrontational, but do you mean like the difference between writing
controls for a jet fighter vs. retrieving an account balance?  I've always
thought they were both 'realtime'.  Just a difference in semantics, I'm
sure, but I am curious what you mean.

Thanks,
Chris

On Fri, Mar 13, 2009 at 1:21 AM, Kengkaj Sathianpantarit <
kengkaj.s@gmail.com> wrote:

> It is "slower", because it has more things to do, but if you're not
> implementing realtime application, this should not be an issue.
>
> Kengkaj
>
>
> On Fri, Mar 13, 2009 at 11:47 AM, Ivan Bojer <Iv...@citrix.com>wrote:
>
>>  Ibatis documentation states that there is performance gain if one uses
>> resultmaps instead of letting Ibatis figure out class mapping on its own. I
>> could not find any more info about why is this a case!? Can anyone elaborate
>> on this? Is this because reflection is slow in general?
>>
>
>


-- 
-- 
Chris O'Connell
Application Developer
Gorilla
312.243.8777 x19

Re: Java reflection performance

Posted by Kengkaj Sathianpantarit <ke...@gmail.com>.
It is "slower", because it has more things to do, but if you're not
implementing realtime application, this should not be an issue.

Kengkaj

On Fri, Mar 13, 2009 at 11:47 AM, Ivan Bojer <Iv...@citrix.com> wrote:

>  Ibatis documentation states that there is performance gain if one uses
> resultmaps instead of letting Ibatis figure out class mapping on its own. I
> could not find any more info about why is this a case!? Can anyone elaborate
> on this? Is this because reflection is slow in general?
>

Re: Java reflection performance

Posted by Clinton Begin <cl...@gmail.com>.
Reflection is not slow enough to worry about.  But if you don't specify the
result maps explicitly, then iBATIS has to access a bunch of metadata, look
stuff up in maps, and synchronize the call.  That's slower.  Still not
enough to worry about IMHO.

Clinton

On Thu, Mar 12, 2009 at 10:47 PM, Ivan Bojer <Iv...@citrix.com> wrote:

>  Ibatis documentation states that there is performance gain if one uses
> resultmaps instead of letting Ibatis figure out class mapping on its own. I
> could not find any more info about why is this a case!? Can anyone elaborate
> on this? Is this because reflection is slow in general?
>