Nik,
If you truly want to eliminate unneeded instantiation, then I would promote
the "created" variable into a first-order entity. Have its fetch type be
set to lazy.
But I personally think all this is a little overkill. I would say that if
you are concerned about adding a simple long... you have other problems.
So following your first instinct, why not do it the simplest way and then
load test it? If it truly represented a problem, it wouldn't be hard to
refactor. The workarounds you are discussing are bound to make the code
ugly and not easy to understand or maintain.
It really sounds like you are trying to solve a problem that may not exist
at all. Over-optimization is as bad of an anti-pattern as any.
-- Rick
On Jul 4, 2010 1:31 PM, "Nikolaos Giannopoulos" <nikol...@brightminds.org>
wrote:
Rick,
Thanks for the response. That is a great idea "except" that once again it
results in: Unnecessary object creation and unnecessary garbage collection.
Imagine having say 6-12 of these types of things and logging in say a 100
users... thats an extra 600-1200 "unnecessary" objects that get created and
discarded immediately. Now imagine logging in a 1000 users... 6000-12000
"unnecessary" objects created and discarded.
And in our case it is even worse as we have several Embedded objects in each
model... so you are "unnecessarily" creating the Embedded object wrapper as
well e.g. we have a TimestampDetails class that retains "created" and
"updated" times so even if we init only the "created" then we have 2 objects
getting created there... so the 6-12 objects per model is quite "real".
Some might try to argue that I am trying to prematurely optimize and that is
bad but "unnecessary" and moreover in this case pointless object creation
should always be avoided in any system as these types of oversights always
seem to bite back when in Production.
Any other ideas? Thoughts???
--Nikolaos
Rick Grashel wrote:
>
> Nikolaos,
>
> Why not simply initialize the variable in the User class ...
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users