struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Schneider <schne...@gmail.com>
Subject Re: Fast ValueStack
Date Sat, 27 Jan 2007 04:19:10 GMT
 From UIBean.java:

        if (this.key != null) {

           if(this.name == null) {
                this.name = key;
            }

            if(this.label == null) {
                this.label = "%{getText('"+ key +"')}";
            }

        }

Looks like it's doing exactly the same thing. :(

Even more interesting, look what's going on in the Text.java UI component:

        for (Iterator iterator = getStack().getRoot().iterator();
             iterator.hasNext();) {
            Object o = iterator.next();

            if (o instanceof TextProvider) {
                TextProvider tp = (TextProvider) o;
                msg = tp.getText(actualName, defaultMessage, values, stack);

                break;
            }
        }

No wonder I didn't see any performance issues here and David did--this 
definitely looks like it would be faster. :)  We should probably adopt 
this model of looking up text in the UIBean class when a key is provided 
as it might speed things up.  I'd love to see some before/after 
numbers.  This might be a tweak you want to apply locally and see if 
there's a performance gain.  (I'll post some if I find some time this 
weekend)
Tom


Ted Husted wrote:
> On 1/26/07, David H. DeWolf <ddewolf@apache.org> wrote:
>> pages.   The real kicker is when I remove the method invocations
>> (%{getText('')})  - this results in a 1100-1200ms/request gain (an
>> average of about 100ms per method invocation) and drops my total request
>> time to well under a second.
>
> The tags now have a "key" attribute that can be used in place of the
> getText OGNL expression.
>
> I'd be curious to know if
>
> <s:textfield key="lastName" />
>
> runs faster than
>
> <s:textfield label="%getText('lastName')" name="lastName" />
>
> If so, I wonder if there other places where we could eliminate common
> OGNL statements by adding functionality to the tags.
>
> -Ted.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message