harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony Wu" <wuyue...@gmail.com>
Subject Re: Case mapping operations performance (switching to ICU or not)
Date Tue, 27 Mar 2007 10:20:23 GMT
Hi Alexey,
Currently, our Character impl is unicode 3.1 compatible and we should
be unicode 4.0 compatible according to spec. IIRC, we have agreed on
adopting ICU for Character related implementation, and we have no
other choice. Otherwise we have to reinvent wheel.

the performance degradation is relative to the current immature
version. What I have done is to optimize it as I can to reduce the
degradation.

BTW, in this case, it will not bring performance degradation.

I did a simple test[1] and the result[2] looked fine.

[1]
public class TestPerformance {
    public static void main(String[] args) {
        String s1 = "aAbBcCdDeEfFgGhHiIjJk";
        String s2 = "bAbBcCdDeEfFgGhHiIjJk";
        long start;
        long end;

        start = System.currentTimeMillis();
        for (int i = 0; i < 1000000; i++) {
            s1.equalsIgnoreCase(s2);
        }
        end = System.currentTimeMillis();
        System.out.println("Original:"+(end - start));

        start = System.currentTimeMillis();
        for (int i = 0; i < 1000000; i++) {
            Util.equalsIgnoreCase(s1, s2);
        }
        end = System.currentTimeMillis();
        System.out.println("Optimized:"+(end - start));
    }
}

[2]
Original:156
Optimized:79

On 3/27/07, Alexey Petrenko <alexey.a.petrenko@gmail.com> wrote:
> 2007/3/23, Tony Wu (JIRA) <jira@apache.org>:
> >
> >    [ https://issues.apache.org/jira/browse/HARMONY-3469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12483389
]
> >
> > Tony Wu commented on HARMONY-3469:
> > ----------------------------------
> >
> > Hi Alexey,
> > you are right, we got worse performance now.
> >
> > There are two reasons,
> > 1.String.equalsIgnoreCase makes use of the Character.toUpper(Lower)Case.
> > These case mapping operations have better performance now, but they will
> > delegate to ICU in the near future for compatibility. ICU is designed to load all
the
> > data(unicode, timezone, locale, etc) during its static initialization. Obviously,
it
> > will do harm to performance.
> > In this case, The Attributes class will be loaded when vm init, these ICU data are
> > not useful at that time. so, my purpose is to defer the loading of Character(ICU).
> Tony, are you saying that you are going to switch to ICU in spite of
> expected performance degradation?
> I think this is not good for Harmony.
>
> SY, Alexey
>
> >
> > 2.this patch does have bad performance:(
> > I add a new method in o.a.h.l.Util and set some condition check to make it fail
> > fast. would you pls try the new one? Thanks very much for your advice.
> >
> >
> >
> >
> > > [classlib][archive]equalsIgnoreCase in the inner class Name could be optimized
> > > ------------------------------------------------------------------------------
> > >
> > >                 Key: HARMONY-3469
> > >                 URL: https://issues.apache.org/jira/browse/HARMONY-3469
> > >             Project: Harmony
> > >          Issue Type: Sub-task
> > >          Components: Classlib
> > >            Reporter: Tony Wu
> > >         Assigned To: Alexey Petrenko
> > >         Attachments: harmony-3469.diff
> > >
> > >
> > > The code in Name's constructor guarantees that its field "name" is composed
 in ASCII haracters.
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > You can reply to this email to add a comment to the issue online.
> >
> >
>


-- 
Tony Wu
China Software Development Lab, IBM

Mime
View raw message