harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gaz Davidson (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-6635) FloatingPointParser uses toLowerCase unnecessarily
Date Thu, 26 Aug 2010 08:21:53 GMT
FloatingPointParser uses toLowerCase unnecessarily

                 Key: HARMONY-6635
                 URL: https://issues.apache.org/jira/browse/HARMONY-6635
             Project: Harmony
          Issue Type: Improvement
         Environment: Android 2.2
            Reporter: Gaz Davidson

A lot of time is being eaten inside FloatingPointParser.java calling String.toLowerCase when
testing for "hex float" types.

> if (s.toLowerCase().indexOf("0x") != -1) 

I imagine that such hex float numbers are very rare, so this is a huge waste of time in the
general case.

I haven't tested this, but it looks to me like the string is already trimmed and so checking
at a specific location should speed this up considerably:

> if (s.size() > 2 && s.charAt(0) =='0' && (s.charAt(1) == 'x' || s.charAt(1)
== 'X')) 

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message