You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by Pavel Ausianik <Pa...@epam.com> on 2002/10/29 18:04:32 UTC

[PATCH] Improve Key mapping

Hello,

XMLJavaMappingRegistry.getKey function uses Class.toString(), which is not
efficient and causes StringBuffer allocation, then expand, since original
size is not enough. In the same time for using as key it is enough to use
class name.

The Class.toString function is following (from SUN's SDK 1.3.1)

    public String toString() {
        return (isInterface() ? "interface " : (isPrimitive() ? "" : "class
"))
            + getName();
    }

I just created separated getKey functions for Class and QName, and added
special case for null values. It is saved me about 10% of all char[]
allocated (only memory usage was tracked)


Best regards,
Pavel


Re: [PATCH] Improve Key mapping

Posted by Scott Nichol <sn...@scottnichol.com>.
Pavel,

I've just committed some changes including those that you propose.  As
always, thanks for your contribution.

Scott Nichol

----- Original Message -----
From: "Pavel Ausianik" <Pa...@epam.com>
To: "Pavel Ausianik" <Pa...@epam.com>;
<so...@xml.apache.org>
Sent: Tuesday, October 29, 2002 12:04 PM
Subject: [PATCH] Improve Key mapping


> Hello,
>
> XMLJavaMappingRegistry.getKey function uses Class.toString(), which is
not
> efficient and causes StringBuffer allocation, then expand, since
original
> size is not enough. In the same time for using as key it is enough to
use
> class name.
>
> The Class.toString function is following (from SUN's SDK 1.3.1)
>
>     public String toString() {
>         return (isInterface() ? "interface " : (isPrimitive() ? "" :
"class
> "))
>             + getName();
>     }
>
> I just created separated getKey functions for Class and QName, and
added
> special case for null values. It is saved me about 10% of all char[]
> allocated (only memory usage was tracked)
>
>
> Best regards,
> Pavel
>
>


------------------------------------------------------------------------
--------


> --
> To unsubscribe, e-mail:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>


--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: [PATCH] Improve Key mapping

Posted by Scott Nichol <sn...@scottnichol.com>.
Pavel,

I've just committed some changes including those that you propose.  As
always, thanks for your contribution.

Scott Nichol

----- Original Message -----
From: "Pavel Ausianik" <Pa...@epam.com>
To: "Pavel Ausianik" <Pa...@epam.com>;
<so...@xml.apache.org>
Sent: Tuesday, October 29, 2002 12:04 PM
Subject: [PATCH] Improve Key mapping


> Hello,
>
> XMLJavaMappingRegistry.getKey function uses Class.toString(), which is
not
> efficient and causes StringBuffer allocation, then expand, since
original
> size is not enough. In the same time for using as key it is enough to
use
> class name.
>
> The Class.toString function is following (from SUN's SDK 1.3.1)
>
>     public String toString() {
>         return (isInterface() ? "interface " : (isPrimitive() ? "" :
"class
> "))
>             + getName();
>     }
>
> I just created separated getKey functions for Class and QName, and
added
> special case for null values. It is saved me about 10% of all char[]
> allocated (only memory usage was tracked)
>
>
> Best regards,
> Pavel
>
>


------------------------------------------------------------------------
--------


> --
> To unsubscribe, e-mail:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>