Thanks for the link, Mark.
StringBuilder, line 137:
s = s.substring(start, decimal) + s.substring(decimal + 1, end);
That's a memory allocation, or more like two or three - just to be able
to call Integer.parseInt() ignoring the period character.
Other interesting things:
end = Math.max(s.indexOf('E'), s.indexOf('e'));
which searches the string twice...
initialParse which returns a "new" object...
Calls to substring() which also make memory allocations...
Calls to indexOf() which search the entire string...
Checks for NANs and infinity which are probably not needed...
I agree with Mark's recommendation - take this source and trim the fat,
see how far it takes you.
-- Kostya
14.04.2011 23:45, Mark Murphy пишет:
On Thu, Apr 14, 2011 at 3:34 PM, Paul<pmmen...@gmail.com> wrote:
That was my thinking exactly - from the trace, a HUGE portion (~80%!)
of the conversion time is spent on string operations that wouldn't
seem to be needed. I couldn't find any link to a native routine via
the traceview.
The toLowerCase() is to handle the possibility of 0x hex values:
http://goo.gl/8EmJP
I don't see any StringBuilder references in that class, which I would
have expected if I'm reading your ASCII traceview output correctly.
You might consider just grabbing the algorithm source, fine-tuning to
suit (e.g., eliminating support for hexadecimal floating-point
numbers, whatever the heck those are), and seeing if that helps.
--
Kostya Vasilyev -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en