On 8 Gen, 15:04, David Turner <
di...@android.com> wrote:
> Ok, just to clarify a few things, we ran our own tests and found the root
> cause of the problem.
> Briefly, we can say that:
>
> - This does not affect anyone using the NDK build system, only people who
> want to use the toolchain in standalone mode.
> - If you use the standalone toolchain, just use the -fpic flag to build your
> object files and get rid of the problem.
>
> The root cause of the problem is that the arm-linux-androideabi
> configuration forces -fPIC by default, which generates slower code in
> certain conditions met by
> the benchmark's loop. The reason for this is historical, and the C compiler
> team has agreed that using -fpic by default for this config makes sense.
>
> NOTE: The Android platform and NDK build scripts always enforce the -fpic
> flag at compile time, which is why this went undetected, and why typical NDK
> users should not be concerned about this.
>
> I have uploaded this patch:
https://review.source.android.com/#change,20276to
> change the default.
>
> I can't guarantee that updated compiler binaries will make it to the
> upcoming NDK update, due to QA milestones. If not, try placing the patch
> under build/tools/toolchain-patches/gcc/ then rebuild the binaries manually
> (see docs/DEVELOPMENT.html), or simply use -fpic in your CFLAGS.
>
> - David
>
> On Fri, Jan 7, 2011 at 3:52 AM, Doug Kwan (關振德) <
dougk...@google.com> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > Can you do an experiment for me? Please try adding -fpic to CFLAGS
> > with NDK4 and -fno-pic to CFLAGS with NDK5 and see if these make a
> > difference and how.
>
> > -Doug
>
> > On Wed, Jan 5, 2011 at 10:21 AM, Doug Kwan (關振德) <
dougk...@google.com>
> > wrote:
> > > Hi,
>
> > > Thanks for reporting this. We are starting to look at that.
>
> > > -Doug
>
> > > On Tue, Jan 4, 2011 at 5:39 PM, teknoraver <
technobo...@gmail.com>
> >
android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegr
oups.com>
> > .
> >
android-ndk...@googlegroups.com<android-ndk%2Bunsubscribe@googlegr
oups.com>
> > .
Yes adding -fno-pic to the NDK5 gives very good performances, better
than the old NDK4:
~ # /data/dry-443 2>/dev/null
Dhrystone Benchmark, Version C, Version 2.2
Microseconds for one run through Dhrystone: 0.4
Dhrystones per Second: 2427184
It's almost as fast as the OpenWrt/CodeSourcery toolchain which
actually is the best available:
~ # /data/dry-cs 2>/dev/null
Dhrystone Benchmark, Version C, Version 2.2
Microseconds for one run through Dhrystone: 0.4
Dhrystones per Second: 2612330
Cheers