RFR(S): 8055055: Improve numeric parsing in java.sql
Claes Redestad
claes.redestad at oracle.com
Thu Sep 11 13:03:21 UTC 2014
Hi,
I've reworked this patch after recent parseInt API updates (8055251) and
removed the test additions which are being covered by 8057826.
I also discovered a missed opportunity to apply the same optimization to
java.sql.Date which I missed earlier:
http://cr.openjdk.java.net/~redestad/8055055/webrev.8
Minimal JMH benchmark for the additional java.sql.Date::valueOf changes:
@State(Scope.Thread)
public class DateBench {
public String date = "2013-01-01";
@Benchmark
public java.sql.Date dateValueOf() {
return java.sql.Date.valueOf(date);
}
}
Benchmark Mode Samples Score Score error Units
DateBench.dateValueOf thrpt 20 4659.810 288.019 ops/ms# before
DateBench.dateValueOf thrpt 20 7554.585 331.703 ops/ms #
after; ~1.6x
/Claes
On 09/04/2014 09:37 PM, Claes Redestad wrote:
>
> On 2014-09-04 21:20, Lance Andersen wrote:
>> Hi Claes,
>>
>> I am assuming the changes to the Time and Timestamp have not changed,
>> you just moved them to the new structure.
>
> Yes, unchanged otherwise.
>
>>
>> WRT the tests, I actually want to add more value testing. I am in
>> the process of updating Time and Timestamp tests to use a
>> DataProvider. Once I finish this, I will send it out for review as
>> it will make it easier to update these tests for additional scenarios
>
> Sounds good!
>
> /Claes
>>
>> Best
>> Lance
>> On Sep 4, 2014, at 4:13 AM, Claes Redestad <claes.redestad at oracle.com
>> <mailto:claes.redestad at oracle.com>> wrote:
>>
>>> Hi,
>>>
>>> I took the liberty to shuffle around the patch to the new structure
>>> and add a few tests, particularly testing subtly different invalid
>>> formats and better exercising the logic around Timestamp nanos
>>> (tested using both old and new code):
>>>
>>> http://cr.openjdk.java.net/~redestad/8055055/webrev.5
>>> <http://cr.openjdk.java.net/%7Eredestad/8055055/webrev.5>
>>>
>>> /Claes
>>>
>>>
>>> On 2014-08-21 21:06, Lance Andersen wrote:
>>>> I think this is OK. However, I want to write some additional tests
>>>> to reduce the chance of regression and add this as part of the putback
>>>>
>>>> I am going to be out of the office for a few days so doubt I will
>>>> get to this for another week or so
>>>>
>>>> Best,
>>>> Lance
>>>> On Aug 13, 2014, at 3:42 PM, Claes Redestad
>>>> <claes.redestad at oracle.com <mailto:claes.redestad at oracle.com>
>>>> <mailto:claes.redestad at oracle.com>> wrote:
>>>>
>>>>> Thanks, Lance!
>>>>>
>>>>> I only ran the jtreg tests under jdk/test/java/sql locally for
>>>>> this (29 passed).
>>>>>
>>>>> /Claes
>>>>>
>>>>> On 2014-08-13 20:14, Lance Andersen wrote:
>>>>>> I will take a look this week. Did you run the unit tests to make
>>>>>> sure they still pass?
>>>>>>
>>>>>>
>>>>>> On Aug 13, 2014, at 12:49 PM, Claes Redestad
>>>>>> <claes.redestad at oracle.com <mailto:claes.redestad at oracle.com>
>>>>>> <mailto:claes.redestad at oracle.com>
>>>>>> <mailto:claes.redestad at oracle.com>> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> can I have a review of this small patch which improves
>>>>>>> performance of java.sql.Time::valueOf (~1.3x) and
>>>>>>> java.sql.Timestamp::valueOf (~1.9x).
>>>>>>>
>>>>>>> Uses Integer.parseInt with offset to make intermediary
>>>>>>> substrings unnecessary and improves the nanosecond fraction
>>>>>>> calculation to not use String concatenation.
>>>>>>>
>>>>>>> bug: https://bugs.openjdk.java.net/browse/JDK-8055055
>>>>>>> webrev: http://cr.openjdk.java.net/~redestad/8055055/webrev.0/
>>>>>>> <http://cr.openjdk.java.net/%7Eredestad/8055055/webrev.0/>
>>>>>>> <http://cr.openjdk.java.net/%7Eredestad/8055055/webrev.0/>
>>>>>>> <http://cr.openjdk.java.net/%7Eredestad/8055055/webrev.0/>
>>>>>>>
>>>>>>> Thanks!
>>>>>>>
>>>>>>> /Claes
>>>>>>
>>>>>> <http://oracle.com/us/design/oracle-email-sig-198324.gif>
>>>>>> <http://oracle.com/us/design/oracle-email-sig-198324.gif><http://oracle.com/us/design/oracle-email-sig-198324.gif>
>>>>>>
>>>>>> <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance
>>>>>> Andersen| Principal Member of Technical Staff | +1.781.442.2037
>>>>>> Oracle Java Engineering
>>>>>> 1 Network Drive
>>>>>> Burlington, MA 01803
>>>>>> Lance.Andersen at oracle.com <mailto:Lance.Andersen at oracle.com>
>>>>>> <mailto:Lance.Andersen at oracle.com>
>>>>>> <mailto:Lance.Andersen at oracle.com>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>> <http://oracle.com/us/design/oracle-email-sig-198324.gif>
>>>> <http://oracle.com/us/design/oracle-email-sig-198324.gif><http://oracle.com/us/design/oracle-email-sig-198324.gif>
>>>>
>>>> <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance
>>>> Andersen| Principal Member of Technical Staff | +1.781.442.2037
>>>> Oracle Java Engineering
>>>> 1 Network Drive
>>>> Burlington, MA 01803
>>>> Lance.Andersen at oracle.com <mailto:Lance.Andersen at oracle.com>
>>>> <mailto:Lance.Andersen at oracle.com>
>>>>
>>>>
>>>>
>>>
>>
>> <http://oracle.com/us/design/oracle-email-sig-198324.gif>
>> <http://oracle.com/us/design/oracle-email-sig-198324.gif><http://oracle.com/us/design/oracle-email-sig-198324.gif>
>>
>> <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance
>> Andersen| Principal Member of Technical Staff | +1.781.442.2037
>> Oracle Java Engineering
>> 1 Network Drive
>> Burlington, MA 01803
>> Lance.Andersen at oracle.com <mailto:Lance.Andersen at oracle.com>
>>
>>
>>
>
More information about the core-libs-dev
mailing list