You don't want to use String.format() if performance is an issue.
String.format() internally creates a new Formatter every time, which
in turn pulls in all kinds of localization stuff.
Instead, create a Formatter yourself (once), and then reuse it for all
your string formatting needs.


On Sun, Oct 25, 2009 at 6:35 PM, Eric Wang <[email protected]> wrote:
> Hi,
>
> String.format("%.3f, %.3f, %.3f", float_1, float_2, float_3); // FPS 25
>
> // FPS 35
> StringBuffer buff = new StringBuffer();
> buff.append((int)(float_1*1000)); buff.append(',');
> buff.append((int)(float_2*1000)); buff.append(',');
> buff.append((int)(float_3*1000)); buff.append(',');
>
> Device is HTC Hero.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to