Re: [android-developers] Re: android.text.format.DateFormat.format performance

2011-10-18 Thread Thierry Legras
Wow nice! I haven't tried JNI before as well and I could not imagine it would be interesting for such small functions. In my case though I will stick to Calendar use as the time spent for time formating is now little enough compared to the remaining parts. Si I won't gain significant in further

[android-developers] Re: android.text.format.DateFormat.format performance

2011-10-18 Thread lbendlin
http://code.google.com/p/android/issues/detail?id=1476 I read somewhere that String.Format works like StringA+StringB in that it creates an entirely new string at each step of the process and dumps the old string. That's why you're supposed to use StringBuilder. -- You received this message

[android-developers] Re: android.text.format.DateFormat.format performance

2011-10-18 Thread Studio LFP
Actually, the format functions use the StringBuilder and doing a straight concat is currently faster than the format functions. It may not be the StringBuilder slowing down the format functions, but whatever it is doing seem to take a bit longer than it should. No worries though, they give us

Re: [android-developers] Re: android.text.format.DateFormat.format performance

2011-10-17 Thread Thierry Legras
I do confirm using Date is about 2x faster. But I tryed using Calendar as Date.getHours/Minutes etc. is deprecated. The good news is that is even faster: Almost 6x faster than my original which was using DateFormat.format Here is my code: private static Calendar sTmpCalendar =

Re: [android-developers] Re: android.text.format.DateFormat.format performance

2011-10-17 Thread Studio LFP
Thanks for the update! I just sat down and put together a JNI routine that uses strftime in C and I took my formatting from 50%+ of the routine that was populating my view down to 0.2%. I would call that a significant improvement! Here is the code I used: Java Class public class

Re: [android-developers] Re: android.text.format.DateFormat.format performance

2011-10-14 Thread Thierry Legras
Thanks Steven! I will try that. As Date.getHours() etc. methods are mentioned as deprecated. I will check with Calendar class as well if it is still faster than DateFormat. Thierry. 2011/10/14 Studio LFP studio@gmail.com It is slow and so is String.format(). I've been messing around with

Re: [android-developers] Re: android.text.format.DateFormat.format performance

2011-10-14 Thread Thierry Legras
No I don't. Time as been converted from string to timemilli on a serveur for efficiency, and I have to convert them back to String when I want to display it. 2011/10/14 Zsolt Vasvari zvasv...@gmail.com Sure, if you don't care about localization issues. On Oct 14, 5:26 am, Thierry Legras

[android-developers] Re: android.text.format.DateFormat.format performance

2011-10-13 Thread Zsolt Vasvari
Sure, if you don't care about localization issues. On Oct 14, 5:26 am, Thierry Legras tleg...@gmail.com wrote: Hi, I am optimizing the critical parts of my code, and I coming to some ResourceCursorAdapter bindView method. Though the method is quite long, I saw on traceview that only 2 lines

[android-developers] Re: android.text.format.DateFormat.format performance

2011-10-13 Thread Studio LFP
It is slow and so is String.format(). I've been messing around with it a bit and here is a *rough *sample I tested: private static final String DATE_AM_PM[] = { am, pm }; private static Date dFormat = new Date(); private static int iHour, iAMPM; public static String formatDate( long lTimestamp