{"push_id":630148870,"size":1,"distinct_size":1,"ref":"refs/heads/5.1","head":"db6829f893524be0cae03b4ab508c9f29d965ef8","before":"d0b42e4229b59a44cfaa53e035ccb137e0ef2f0f","commits":[{"sha":"db6829f893524be0cae03b4ab508c9f29d965ef8","author":{"email":"6d485056cbf30619c853f9f9f7adb81f52f1621e@google.com","name":"Neil Fuller"},"message":"Switch from FloatMath -> Math and Math.hypot where possible\n\nThe motivation is an API change: FloatMath is going to be\ndeprecated and/or removed. Performance is not the goal of\nthis change.\n\nThat said...\n\nMath is faster than FloatMath with AOT compilation.\n\nWhile making the change, occurances of:\n\n{Float}Math.sqrt(x * x + y * y) and\n{Float}Math.sqrt({Float}Math.pow(x, 2) + {Float}Math.pow(y, 2))\n\nhave been replaced with:\n\n{(float)} Math.hypot(x, y)\n\nRight now there is no runtime intrinsic for hypot so is not faster\nin all cases for AOT compilation:\n\nMath.sqrt(x * x + y * y) is faster than Math.hypot(x, y) with\nAOT, but all other combinations of FloatMath, use of pow() etc.\nare slower than hypot().\n\nhypot() has the advantage of being self documenting and\ncould be optimized in future. None of the behavior differences\naround NaN and rounding appear to be important for the cases\nlooked at: they all assume results and arguments are in range\nand usually the results are cast to float.\n\nDifferent implementations measured on hammerhead / L:\n\nAOT compiled:\n\n[FloatMath.hypot(x, y)]\nbenchmark=Hypot_FloatMathHypot} 633.85 ns; σ=0.32 ns @ 3 trials\n\n[FloatMath.sqrt(x*x + y*y)]\nbenchmark=Hypot_FloatMathSqrtMult} 684.17 ns; σ=4.83 ns @ 3 trials\n\n[FloatMath.sqrt(FloatMath.pow(x, 2) + FloatMath.pow(y, 2))]\nbenchmark=Hypot_FloatMathSqrtPow} 1270.65 ns; σ=12.20 ns @ 6 trials\n\n[(float) Math.hypot(x, y)]\nbenchmark=Hypot_MathHypot} 96.80 ns; σ=0.05 ns @ 3 trials\n\n[(float) Math.sqrt(x*x + y*y)]\nbenchmark=Hypot_MathSqrtMult} 23.97 ns; σ=0.01 ns @ 3 trials\n\n[(float) Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))]\nbenchmark=Hypot_MathSqrtPow} 156.19 ns; σ=0.12 ns @ 3 trials\n\nInterpreter:\n\nbenchmark=Hypot_FloatMathHypot} 1180.54 ns; σ=5.13 ns @ 3 trials\nbenchmark=Hypot_FloatMathSqrtMult} 1121.05 ns; σ=3.80 ns @ 3 trials\nbenchmark=Hypot_FloatMathSqrtPow} 3327.14 ns; σ=7.33 ns @ 3 trials\nbenchmark=Hypot_MathHypot} 856.57 ns; σ=1.41 ns @ 3 trials\nbenchmark=Hypot_MathSqrtMult} 1028.92 ns; σ=9.11 ns @ 3 trials\nbenchmark=Hypot_MathSqrtPow} 2539.47 ns; σ=24.44 ns @ 3 trials\n\nBug: https://code.google.com/p/android/issues/detail?id=36199\nChange-Id: I06c91f682095e627cb547d60d936ef87941be692\nSigned-off-by: Chet Kener <Cl3Kener@gmail.com>\n\nConflicts:\n\ttools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java\n\nSigned-off-by: Chet Kener <Cl3Kener@gmail.com>","distinct":true,"url":"https://api.github.com/repos/TeamGlade/frameworks_base/commits/db6829f893524be0cae03b4ab508c9f29d965ef8"}]}