Sean Schofield wrote:
Yes object creation is expensive but so are a lot of things.  Using
instanceof and reflection is expensive too but that doesn't stop
people from using it.

yes, right!

My theory on performance issues like this is that you should be aware
when something is a little more expensive than average (like object
creation, string concatenation, etc.) and try to cut down on that if
possible.  The thing about it is that most of the time your efforts to
"optimize" your code will result in unecessary complexity without any
real benefit.  You shouldn't ignore performance issues but IMO too
many programmers put too much emphasis on them.

memory is *very* cheap these days... :-)

Ask yourself, are you writing the next Amazon.com or is this just a
typical web application that has a few hundred users?  Will the user
really notice the difference between 110 ms and 108ms?

LOL, no I am not... only a simple app that is used to to often (a guess)...

-Matthias


Code that does exactly what you want and is easy to maintain.  That
should always be your goal.  Don't ignore performance issues but don't
let them stop you from doing what you want to do.

sean



On Fri, 11 Feb 2005 14:18:49 +0100, Matthias Wessendorf
<[EMAIL PROTECTED]> wrote:

Sean,

thanks for your replay

Sean Schofield wrote:

Matthias,

Its true that object creation can be expensive but you also have to
consider how often the underlying data (assuming it comes from a
database) changes.  In Struts you have ActionForms which are
essentially request scope beans (similar to but not the same as
backing beans).  Its no big deal constantly creating these every

sure not similar, since backing beans has more *features* as only being a "form-bean". Btw. scope attribute's value of <action/> is "session" as default.


request.

You also want to consider that session beans take up server memory.
If you have ten different backing beans for ten different pages you
will have ten beans sitting around in memory for each user that goes
through those ten pages (until the session expires.)

ah, yes good point! thanks.


In my application we are going to have to use a lot of request scope
beans beacause the data needs to be up to date.  It can be changed by

That is also the thing that I wanted to do! But my co-worker said: "make them to session, sicne creation is VERY expensive"

--> reason for my mail


other users at any time, so we want to show the latest on every
request.  In theory you could have a session bean to avoid recreating
the object and use a scheme to repopulate it but I am not wild about
that.

Ok, thanks!

I remember that Craig also allways mentioned request instead of session,
but couldn't find a thread on that...

-Matthias


Anyways that is my .02,

sean


On Fri, 11 Feb 2005 11:35:16 +0100, Matthias Wessendorf <[EMAIL PROTECTED]> wrote:


Hi all,

I am just on reading [1]. There is mentioned, that
object creation is very expensive and you should better
reuse objects instead of creating them often.

Now I thought about scope of my backing beans.
What should be better request or session?

If I have request scoped backing beans that
get often created by ONE user and I have MANY
users... will request scope slow down my web app?

Ok... application is also there, but that is
an other stage :-) I would use such a backing
bean only for *knowing* about ALL users logged
into the application.

[1] http://www.oreilly.com/catalog/javapt/chapter/ch04.html


-Matthias



--
Matthias We�endorf
Aechterhoek 18
DE-48282 Emsdetten
Germany
phone: +49-2572-9170275
cell phone: +49-179-1118979
email: matzew AT apache DOT org
url: http://www.wessendorf.net
callto://mwessendorf (Skype)
icq: 47016183

--
Matthias We�endorf
Aechterhoek 18
DE-48282 Emsdetten
Germany
phone: +49-2572-9170275
cell phone: +49-179-1118979
email: matzew AT apache DOT org
url: http://www.wessendorf.net
callto://mwessendorf (Skype)
icq: 47016183




-- Matthias We�endorf Aechterhoek 18 DE-48282 Emsdetten Germany phone: +49-2572-9170275 cell phone: +49-179-1118979 email: matzew AT apache DOT org url: http://www.wessendorf.net callto://mwessendorf (Skype) icq: 47016183

Reply via email to