logo       

Re: java.lang.String class in Dalvik: msg#00076

android-platform

Subject: Re: java.lang.String class in Dalvik


On Jun 2, 7:37 pm, Mercury <bao...@xxxxxxxxx> wrote:
> As I found that at the current, the methods of java.lang.String class
> of Dalvik are mostly implemented by Java code and maybe it makes the
> performance reduce. So my thinking is that can we move the
> implementation to JNI to improve performance?

Four String methods -- charAt, compareTo, equals, and length -- are
"inlined" by the VM, and are not going to get much faster.

There are probably a few others that could benefit from this
treatment, but I'm guessing that most string-centric processing in
Java will likely be dominated by the cost of String allocations. (The
above weren't inlined because of a measured performance need -- the
inlining was an experiment that needed a test subject.)

At any rate, converting to JNI is likely counter-productive. It's
more expensive to invoke a native JNI method than a virtual method,
and the native code has to issue JNI calls to access the various
fields in String. Many common operations on short strings would
actually take longer.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"android-platform" group.
To post to this group, send email to android-platform@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
android-platform+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/android-platform?hl=en
-~----------~----~----~----~------~----~------~--~---

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | Mail Home | sitemap | FAQ | advertise