The motivation is an API change: FloatMath is going to be
deprecated and/or removed. Performance is not the goal of
this change.
That said...
Math is faster than FloatMath with AOT compilation.
While making the change, occurances of:
{Float}Math.sqrt(x * x + y * y) and
{Float}Math.sqrt({Float}Math.pow(x, 2) + {Float}Math.pow(y, 2))
have been replaced with:
{(float)} Math.hypot(x, y)
Right now there is no runtime intrinsic for hypot so is not faster
in all cases for AOT compilation:
Math.sqrt(x * x + y * y) is faster than Math.hypot(x, y) with
AOT, but all other combinations of FloatMath, use of pow() etc.
are slower than hypot().
hypot() has the advantage of being self documenting and
could be optimized in future. None of the behavior differences
around NaN and rounding appear to be important for the cases
looked at: they all assume results and arguments are in range
and usually the results are cast to float.
Different implementations measured on hammerhead / L:
AOT compiled:
[FloatMath.hypot(x, y)]
benchmark=Hypot_FloatMathHypot} 633.85 ns; σ=0.32 ns @ 3 trials
[FloatMath.sqrt(x*x + y*y)]
benchmark=Hypot_FloatMathSqrtMult} 684.17 ns; σ=4.83 ns @ 3 trials
[FloatMath.sqrt(FloatMath.pow(x, 2) + FloatMath.pow(y, 2))]
benchmark=Hypot_FloatMathSqrtPow} 1270.65 ns; σ=12.20 ns @ 6 trials
[(float) Math.hypot(x, y)]
benchmark=Hypot_MathHypot} 96.80 ns; σ=0.05 ns @ 3 trials
[(float) Math.sqrt(x*x + y*y)]
benchmark=Hypot_MathSqrtMult} 23.97 ns; σ=0.01 ns @ 3 trials
[(float) Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))]
benchmark=Hypot_MathSqrtPow} 156.19 ns; σ=0.12 ns @ 3 trials
Interpreter:
benchmark=Hypot_FloatMathHypot} 1180.54 ns; σ=5.13 ns @ 3 trials
benchmark=Hypot_FloatMathSqrtMult} 1121.05 ns; σ=3.80 ns @ 3 trials
benchmark=Hypot_FloatMathSqrtPow} 3327.14 ns; σ=7.33 ns @ 3 trials
benchmark=Hypot_MathHypot} 856.57 ns; σ=1.41 ns @ 3 trials
benchmark=Hypot_MathSqrtMult} 1028.92 ns; σ=9.11 ns @ 3 trials
benchmark=Hypot_MathSqrtPow} 2539.47 ns; σ=24.44 ns @ 3 trials
Bug: https://code.google.com/p/android/issues/detail?id=36199
Change-Id: I06c91f682095e627cb547d60d936ef87941be692
HAVE_OOM_ADJ is really __linux__, and this code should never be run on
another platform.
Bug: 17641445
Change-Id: Ib8174106b6d03c9c2429794a4f582c09cb308646
Add the app directory to the arguments for starting a process.
Add a check for NeedsNativeBridge and a call to PreInitializeBridge
in the native fork code.
Change-Id: I0b93da93251c6b4638de786bf98cf99df07c3fc2
All supported locales use only U+2025 and U+2026 to represent
ellipses, and it will unlikely change in future. Given translated
resources are inconsistent and often use three dots it is safer
to use constants instead of resources.
Change-Id: I51a6cb903f62f739fbadd6b78e5765c0028d641a
The build system takes care of linking the correct STL and gtest
libraries for you, and specifying them manually confuses the build
system when using libc++.
Change-Id: I9f76ab26a63ace51293614cfb5ca002f37438e02
Clang complains about ambiguity between std::hash and ::hash (locally
defined). There's no need to pull in the whole namespace for two uses of
std::map anyway.
Change-Id: Icbaa7ebbaad05999988784ad34662c721fb12b29
In C++11 mode, "foo"MACRO_THAT_EXPANDS_TO_STRING gets lexed as a user
defined literal. Add space around the macro.
Change-Id: I24fbe1fda483db4a8c606e80dbe17430ad070dc2
The address of a reference will never be null in well formed C++ code.
The function returning the value being checked simply returns a
dereferenced pointer (which is just going to segfault if it is null!).
Change-Id: I3a4eb6adfc003c63ebf21b81d46088d52154d99d
When compiling in C++ mode, the compiler will complain about conversions
from uint16_t to char16_t. Be consistent in using char16_t for strings.
Change-Id: I052b6176ced635162920b31560052d9a64f92764
Change parameter `nativeObject` from type `jint` to `jlong` to match its JNI
signature.
Bug: 12890910
(cherry picked from commit 3cb78498d3f664f541ba7d28f4543cf8c12733f1)
Reported-By: ashok.bhat@arm.com, marcus.oakland@arm.com
Change-Id: I624dfb41485be823d31797514664d3a5f9e52eb0
Broken build.
frameworks/base/services/tests/servicestests/src/com/android/server/pm/SELinuxMMACTests.java:89: error: constructor PackageParser in class PackageParser cannot be applied to given types;
PackageParser packageParser = new PackageParser(archiveFilePath);
^
required: no arguments
found: String
reason: actual and formal argument lists differ in length
frameworks/base/services/tests/servicestests/src/com/android/server/pm/SELinuxMMACTests.java:93: error: method parsePackage in class PackageParser cannot be applied to given types;
PackageParser.Package pkg = packageParser.parsePackage(sourceFile,
^
required: File,int
found: File,String,DisplayMetrics,int
reason: actual and formal argument lists differ in length
frameworks/base/services/tests/servicestests/src/com/android/server/pm/SELinuxMMACTests.java:99: error: incompatible types
boolean savedCerts = packageParser.collectCertificates(pkg, 0);
^
required: boolean
found: void
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
3 errors
make: *** [out/target/common/obj/APPS/FrameworksServicesTests_intermediates/classes-full-debug.jar] Error 41
This reverts commit 2f446561f2f6d1b320b34432854d2f55e5b56f9e.
Change-Id: I0aa992d7b9eccce7e38c430a8a96084a6ee99866
Added unit tests to help with future integration and regression
testing.
Change-Id: I5e7d709e80ccbbe1dde1dc26b3e9a155f5009ad1
Signed-off-by: rpcraig <rpcraig@tycho.ncsc.mil>