Reflection in 1.3 , 1.4 is much faster than it was in ancient java versions,
but is still slow compared to for example, using maps, etc.

In the case of a struts app for use with DTOs however, the difference is not
going to be of significance. In general, for most such applications it is
such things as access to the database that is the bottleneck, and also speed
on the network, etc... A difference of a couple of nanoseconds to populate a
DTO bean based on a user submission - or a dynabean from a bean for ui
display... I mean really - its quite irrelevant. Even if you have 5000 users
online simultaneously its probably not the bean population thats going to be
causing you problems...

Ive found it never works to try and think in terms of meaningless absolutes
like "reflection is slow". It always depends on the context of your problem.
If you need to populate a million beans in a tight loop, reflection may not
be your best bet, but for populating a few dynabeans here and there ... the
performance difference is irrelevant. Abandoning reflection may get your
request processing time down from 1000 milliseconds to 999 milliseconds or
something like that... (I dont have the actual figures)

I personally have found that leveraging BeanUtils, has proven very
productive. It is very useful, and you wont regret the flexibility that
comes with it.

Heres a link to an older (2001) posting by Ted that itself contains quite a
few relevant links. Worth a read:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg14397.html


hth
Andrew

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Sent: Wednesday, 7 January 2004 18:41
To: [EMAIL PROTECTED]
Subject: RE: BeanUtils use in struts


Hi,

We had teh same question.But I have read that the performance issue with
reflection has been resolved from jdk1.3 and jdk 1.4 so that it is almost
undetectable.Check the release notes for those versions of jdk to get more
details about the same.


HTH.
regards,
Shirish
-----Original Message-----
From: Marco Mistroni [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 07, 2004 11:27 AM
To: 'Struts Users Mailing List'
Subject: BeanUtils use in struts


Hi all,
        I have a  question about using BeanUtils in Struts.
For saving me from writing lot of code, I am using DynaActionForms in my
pages.
In the backend, I have some DTOs, so I decided in order to make
My app more 'extensible' without rewriting too much code, to use
BeanUtils to populate my DTOs with values from DynaActionForm, and to
Use the same mechanism to populate DynaActionForm from DTO.

Now, pls correct me if I am wrong, but BeanUtils uses reflection in
Order to populate properties..

I have read from some books ('Effective Java') that using reflection
Is much slower than invoking methods normally..
In my app, I will gain flexibility (I don't need to write methods for
Populating dtos from form and vice versa), but am I going to lose much
In tems of performance?

Anyone can give his comments?  I think BeanUtils is of great help,and it
would be a pity to give up the benefits that I get from it...

Best regards
        marco


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to