db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "TomohitoNakayama" <tomon...@basil.ocn.ne.jp>
Subject Re: [jira] Commented: (DERBY-525) getAsciiStreamshould replace non-ASCII characters with 0x3f, '?' to match embedded
Date Fri, 30 Sep 2005 16:12:12 GMT
Hello.

Well  ... 
I decide to use "length" instance variable of  byte[].

Then, I don't need to add new local variable .

Best regards.

/*

         Tomohito Nakayama
         tomonaka@basil.ocn.ne.jp
         tomohito@rose.zero.ad.jp
         tmnk@apache.org

         Naka
         http://www5.ocn.ne.jp/~tomohito/TopPage.html

*/
----- Original Message ----- 
From: "Sunitha Kambhampati" <ksunithaghm@gmail.com>
To: "Derby Development" <derby-dev@db.apache.org>
Sent: Friday, September 30, 2005 8:07 AM
Subject: Re: [jira] Commented: (DERBY-525) getAsciiStreamshould replace non-ASCII characters
with 0x3f, '?' to match embedded


> TomohitoNakayama wrote:
> 
>> Hello.
>>
>> I have one question ...
>>
>>> I looked at the patch briefly, and had one minor comment.  In 
>>> convertToAsciiByteArray, it might be better performance wise, if we 
>>> calculate the original.length only once and use it in the for loop.
>>
>>
>> Can it be improvement of performance so much ?
>>
>> Length of String object cannot be changed and there would be very less 
>> performance improvement .
>> //Improvement would be just saving time of calling method .
>>
> I think it is cheaper to store the int value, rather than calling the 
> method N times.  I did a simple test just to get some numbers with using 
> the length() versus calculating once.  Note- this test doesnt make much 
> sense otherwise..
> 
> string length = 810023
> test  calls method  length() each time   = 140 ms
> test precomputes length and uses the stored length = 90ms.
> 
> ex.
>        for(int j= 0; j < len; j++)
>        {
>            if (sb1.charAt(j) == 'a')
>            {
>               c = sb1.charAt(j);
>            }
>        }
> 
> versus,  computing the length() each time.
> ---------------
> 
> Java^TM Performance Tuning and Java Optimization Tips : 
> ftp://ftp.glenmccl.com/pub/free/jperf.pdf  : check out section 4.5.where 
> the author mentions some timing details, although the example code is 
> not right. :(
> 
> Hope this helps,
> Sunitha.
> 
>> Rather, I feel question for adding (local) variable , because I don't 
>> want to increase number of variable even if it is local ....
>>
>> Best regards.
>>
>> /*
>>
>>         Tomohito Nakayama
>>         tomonaka@basil.ocn.ne.jp
>>         tomohito@rose.zero.ad.jp
>>         tmnk@apache.org
>>
>>         Naka
>>         http://www5.ocn.ne.jp/~tomohito/TopPage.html
>>
>> */
>> ----- Original Message ----- From: "Sunitha Kambhampati (JIRA)" 
>> <derby-dev@db.apache.org>
>> To: <derby-dev@db.apache.org>
>> Sent: Friday, September 30, 2005 2:13 AM
>> Subject: [jira] Commented: (DERBY-525) getAsciiStreamshould replace 
>> non-ASCII characters with 0x3f, '?' to match embedded
>>
>>
>>>    [ 
>>> http://issues.apache.org/jira/browse/DERBY-525?page=comments#action_12330828

>>> ]
>>>
>>> Sunitha Kambhampati commented on DERBY-525:
>>> -------------------------------------------
>>>
>>> It would be great if you could add a testcase for this.
>>>
>>> I looked at the patch briefly, and had one minor comment.  In 
>>> convertToAsciiByteArray, it might be better performance wise, if we 
>>> calculate the original.length only once and use it in the for loop.
>>>
>>>
> 
> 
> 
> 
> -- 
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.344 / Virus Database: 267.11.9/115 - Release Date: 2005/09/29
> 
>


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.9/115 - Release Date: 2005/09/29


Mime
View raw message