Checks for context availability

7 Messages Forum Options Options
Permalink
sabob
Checks for context availability
Reply Threaded More
Print post
Permalink
There are a couple of checks for context availability. I assume these
checks were used prior to having context available on the ThreadLocal?
Meaning these checks can be removed?

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Click-development mailing list
Click-development@...
https://lists.sourceforge.net/lists/listinfo/click-development
Malcolm Edgar-2
Re: Checks for context availability
Reply Threaded More
Print post
Permalink
Yes that is correct, they are redundant now.

regards Malcolm Edgar

On Wed, Jul 23, 2008 at 10:15 PM, bob <sabob1@...> wrote:

> There are a couple of checks for context availability. I assume these
> checks were used prior to having context available on the ThreadLocal?
> Meaning these checks can be removed?
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Click-development mailing list
> Click-development@...
> https://lists.sourceforge.net/lists/listinfo/click-development
>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Click-development mailing list
Click-development@...
https://lists.sourceforge.net/lists/listinfo/click-development
sabob
Re: Checks for context availability
Reply Threaded More
Print post
Permalink
Have removed these checks and updated certain Controls to cache the
Context locally inside methods where it was reused more than once.

Still I doubt this makes any real difference to running apps ;-)

Wonder if the escapeHtml algorithm can be enhanced as that is what is
showing up in Yourkit.

Another enhancement is making column id generation optional. The only
use case I know of for this feature is Selenium tests. Not sure many
folk need them id's by default...

Malcolm Edgar wrote:

> Yes that is correct, they are redundant now.
>
> regards Malcolm Edgar
>
> On Wed, Jul 23, 2008 at 10:15 PM, bob <sabob1@...> wrote:
>> There are a couple of checks for context availability. I assume these
>> checks were used prior to having context available on the ThreadLocal?
>> Meaning these checks can be removed?
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK & win great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Click-development mailing list
>> Click-development@...
>> https://lists.sourceforge.net/lists/listinfo/click-development
>>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Click-development mailing list
Click-development@...
https://lists.sourceforge.net/lists/listinfo/click-development
Malcolm Edgar-2
Re: Checks for context availability
Reply Threaded More
Print post
Permalink
On Thu, Jul 24, 2008 at 8:57 AM, bob <sabob1@...> wrote:
> Have removed these checks and updated certain Controls to cache the
> Context locally inside methods where it was reused more than once.
>
> Still I doubt this makes any real difference to running apps ;-)

That's good. I have also checked in changes to cache the context as a
transient variable in the Page and AbstractControl. This instance
variable is cleared in their respective onDestroy() methods.  This
pretty well eliminates the threadlocal lookup cost around for the
Context object.

I have given these variables private scope, as we dont wan't people
referencing them directly.  People will also have to ensure they call
super.onDestroy() in their Page and Control subclasses in their
onDestroy methods if they use stateful pages.

For the Menu control I had to do a ThreadLocal lookup in getContext()
as the cached rootMenu is static and clearing the context in
onDestroy() method caused NPE with multi-threaded access.

> Wonder if the escapeHtml algorithm can be enhanced as that is what is
> showing up in Yourkit.
>
> Another enhancement is making column id generation optional. The only
> use case I know of for this feature is Selenium tests. Not sure many
> folk need them id's by default...

You know I think that is a good idea, should probably follow the
Column sortable pattern for this:

    /**
     * Return the column sortable status. If the column sortable status is not
     * defined the value will be inherited from the
     * {@link Table#sortable} property.
     *
     * @return the column sortable status
     */
    public boolean getSortable() {
        if (sortable == null) {
            if (getTable() != null) {
                return getTable().getSortable();
            } else {
                return false;
            }

        } else {
            return sortable.booleanValue();
        }
    }

I have been profiling the HtmlStringBuffer with the Click Examples |
Advanced Table example and Jrat was showing awful escaping performance
around the ActionLink href attributes. I find it a bit hard to
comprehend why this is so expensive, and I wonder if it is an artifact
of Jrat. Anyway I have added a
HtmlStringBuffer#appendAttributeEscaped(String, Object) method for
explicitly escaping attribute values. This pretty well fixes this
performance issue.  While it might sound like a fringe case, this
table pattern with link decorators is very common in our code.

Please keep an eye out of any issues this may introduce in the M3 release.

> Malcolm Edgar wrote:
>> Yes that is correct, they are redundant now.
>>
>> regards Malcolm Edgar
>>
>> On Wed, Jul 23, 2008 at 10:15 PM, bob <sabob1@...> wrote:
>>> There are a couple of checks for context availability. I assume these
>>> checks were used prior to having context available on the ThreadLocal?
>>> Meaning these checks can be removed?
>>>
>>> -------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>>> Build the coolest Linux based applications with Moblin SDK & win great prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in the world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> _______________________________________________
>>> Click-development mailing list
>>> Click-development@...
>>> https://lists.sourceforge.net/lists/listinfo/click-development
>>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK & win great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Click-development mailing list
> Click-development@...
> https://lists.sourceforge.net/lists/listinfo/click-development
>

regards Malcolm Edgar

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Click-development mailing list
Click-development@...
https://lists.sourceforge.net/lists/listinfo/click-development
sabob
Re: Checks for context availability
Reply Threaded More
Print post
Permalink
Hi Malcolm,

Malcolm Edgar wrote:
>> Another enhancement is making column id generation optional. The only
>> use case I know of for this feature is Selenium tests. Not sure many
>> folk need them id's by default...
>
> You know I think that is a good idea, should probably follow the
> Column sortable pattern for this:


Yep this makes quite a difference but mostly because the rendered html
is alot smaller:

Before:
Page size: 20kb
Requests per second: 1530

After:
Page size: 14kb
Requests per second: 2200

No its not an error, that is a 43% performance gain for this test :)

As there have been quite a number of improvements I will rerun the
benchmark incrementally to clearly indicate what % each change made.

kind regards

bob

>
>     /**
>      * Return the column sortable status. If the column sortable status is not
>      * defined the value will be inherited from the
>      * {@link Table#sortable} property.
>      *
>      * @return the column sortable status
>      */
>     public boolean getSortable() {
>         if (sortable == null) {
>             if (getTable() != null) {
>                 return getTable().getSortable();
>             } else {
>                 return false;
>             }
>
>         } else {
>             return sortable.booleanValue();
>         }
>     }
>
> I have been profiling the HtmlStringBuffer with the Click Examples |
> Advanced Table example and Jrat was showing awful escaping performance
> around the ActionLink href attributes. I find it a bit hard to
> comprehend why this is so expensive, and I wonder if it is an artifact
> of Jrat. Anyway I have added a
> HtmlStringBuffer#appendAttributeEscaped(String, Object) method for
> explicitly escaping attribute values. This pretty well fixes this
> performance issue.  While it might sound like a fringe case, this
> table pattern with link decorators is very common in our code.
>
> Please keep an eye out of any issues this may introduce in the M3 release.
>
>> Malcolm Edgar wrote:
>>> Yes that is correct, they are redundant now.
>>>
>>> regards Malcolm Edgar
>>>
>>> On Wed, Jul 23, 2008 at 10:15 PM, bob <sabob1@...> wrote:
>>>> There are a couple of checks for context availability. I assume these
>>>> checks were used prior to having context available on the ThreadLocal?
>>>> Meaning these checks can be removed?
>>>>
>>>> -------------------------------------------------------------------------
>>>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>>>> Build the coolest Linux based applications with Moblin SDK & win great prizes
>>>> Grand prize is a trip for two to an Open Source event anywhere in the world
>>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>>> _______________________________________________
>>>> Click-development mailing list
>>>> Click-development@...
>>>> https://lists.sourceforge.net/lists/listinfo/click-development
>>>>
>>> -------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>>> Build the coolest Linux based applications with Moblin SDK & win great prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in the world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK & win great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Click-development mailing list
>> Click-development@...
>> https://lists.sourceforge.net/lists/listinfo/click-development
>>
>
> regards Malcolm Edgar
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Click-development mailing list
Click-development@...
https://lists.sourceforge.net/lists/listinfo/click-development
Toni Lamar
Re: Checks for context availability
Reply Threaded More
Print post
Permalink
In reply to this post by sabob
sabob wrote:
Another enhancement is making column id generation optional. The only
use case I know of for this feature is Selenium tests. Not sure many
folk need them id's by default...
We do Selenium tests allot (but never in production).
With this new free tool:
http://cubictest.openqa.org/
even non-developers can create and maintain them - this lowers the costs of QA very much.

The strange part is that with this tool, the behavior and diagrams match the sourcecode of click baseed webapplications very strongly (I believe because Click is page oriented).
We also used it to make diagrams of applications for the user docs. I believe it could be used here to show a click example with a bigger detail :) (maybe to send it to TSS too :) ).

Thnx.
sabob
Re: Checks for context availability
Reply Threaded More
Print post
Permalink
Toni Lamar wrote:
> We do Selenium tests allot (but never in production).


Nods rendering column id's is now optional on a table or per column
instance.

The gains are pretty significant :)


> With this new free tool:
> http://cubictest.openqa.org/
> even non-developers can create and maintain them - this lowers the costs of
> QA very much.
>
> The strange part is that with this tool, the behavior and diagrams match the
> sourcecode of click baseed webapplications very strongly (I believe because
> Click is page oriented).
> We also used it to make diagrams of applications for the user docs. I
> believe it could be used here to show a click example with a bigger detail
> :) (maybe to send it to TSS too :) ).


The tool looks nice. We should look at creating some GUI tests for the
examples to help with regression. There are about 3 examples that are
often problematic when changes are made.

regards

bob

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Click-development mailing list
Click-development@...
https://lists.sourceforge.net/lists/listinfo/click-development