fadden wrote:
>
> http://developer.android.com/guide/developing/tools/traceview.html
Thanks for the excellent link.
More testing has brought the parsetime down to about 2 minutes on my
emulator - I believe the 8 minutes I quoted above was for a parse with
SAX, but perhaps other things were happening on my machine at the
time. The two main things I've changed are:
- replaced as many BufferedInputStream.read() with
BufferedInputStream.read( char[], int, int ), where I easily can.
- replaced Double.valueOf( Double.valueOf( String.valueOf( buf, 0,
len ) ).doubleValue() * 1E6 ).intValue() with my own allocationless 24
line routine:
// char[] to int * 1E6 converter
// seems to work for me - your mileage may vary!
public int convCharArrayToInt1E6( byte[] buf, int start, int len )
throws SchemaException {
int rc = 0;
int i = 0, j = 0;
for( i=start; i<start+len; i++ ) {
if( buf[i] != '-' && buf[i] != '.' )
CHAR_BUF[j++] = (char) buf[i];
}
// determine where 1st digit is as there may be a '-'
int firstDig = (buf[start] == '-' ? 1 : 0);
// USGS KML uses ##.######## format
// determine # of digits to make 'millionths of a degree'
int dot = (buf[ start + firstDig + 1 ] == '.' ? 7 : (buf[ start +
firstDig + 2 ] == '.' ? 8 : (buf[ start + firstDig + 3 ] == '.' ? 9 :
0) ) );
if( dot == 0 ) { throw new SchemaException(); }
// build int
rc = 0;
for( i=0; i < dot; i++ ) {
rc = rc * 10 + ( i < j ? (int) CHAR_BUF[i] - (int) '0' : 0 );
}
rc = (buf[start] == '-' ? -rc : rc); // neg check
return rc;
}
>From the device bogomips numbers I've seen on the net, real devices
appear to be 2x my emulator. So, if the file only takes a minute to
parse and I only need to do this once an hour I'm much closer to done.
Thanks for the help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Android Discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---