aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/MathBench.cpp
Commit message (Collapse)AuthorAge
* remove SkTCastGravatar Mike Klein2018-06-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | SkTCast is functionally equivalent to reinterpret_cast. The comment about SkTCast helping to avoid strict alising issues is not true. Dereferencing a pointer cast to a pointer of an unrelated type is always undefined, even if smuggled through a union like in SkTCast. To really avoid aliasing issues, you need to make a union[1] of the two value types, or better, memcpy between values. I've had to fix MatrixText.cpp where switching to reinterpret_cast actually let Clang notice and warn that we're exploiting undefined behavior, and GrSwizzle.h and SkCamera.cpp caught by GCC. I've switched SkTLList over to use SkAlignedSTStorage, which seems to help convince some GCC versions that fObj is used in a sound way. [1] The union punning trick is non-standard in C++, but GCC and MSVC both explicitly support it. I believe Clang does not officially explicitly support it, but probably does quietly for GCC compatibility. Change-Id: I71822e82c962f9aaac8be24d3c0f39f4f8b05026 Reviewed-on: https://skia-review.googlesource.com/134947 Commit-Queue: Mike Klein <mtklein@chromium.org> Commit-Queue: Brian Salomon <bsalomon@google.com> Auto-Submit: Mike Klein <mtklein@chromium.org> Reviewed-by: Brian Salomon <bsalomon@google.com>
* Remove trailing whitespace.Gravatar Ben Wagner2017-10-09
| | | | | | | | | | | Also adds a presubmit to prevent adding trailing whitespace to source code in the future. Change-Id: I41a4df81487f6f00aa19b188f0cac6a3377efde6 Reviewed-on: https://skia-review.googlesource.com/57380 Reviewed-by: Ravi Mistry <rmistry@google.com> Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Ben Wagner <bungeman@google.com>
* make most of SkColorPriv.h privateGravatar Cary Clark2017-09-15
| | | | | | | | | | | | | created new file src/core/SkColorData.h for internal consumption. Note that many of the functions there are unused as well. Bug: skia: 6898 R: reed@google.com Change-Id: I25bfd5a9c21f53558c4ca65a77eb5d322d897c6d Reviewed-on: https://skia-review.googlesource.com/46848 Commit-Queue: Cary Clark <caryclark@google.com> Reviewed-by: Mike Reed <reed@google.com>
* use unsigned to avoid runtime overflow detectionGravatar Mike Reed2017-08-09
| | | | | | | | | Bug: skia: Change-Id: I487930955f75048ea27a1bcc61f7e0849c63759b Reviewed-on: https://skia-review.googlesource.com/32681 Commit-Queue: Mike Reed <reed@google.com> Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
* handle overflows in float->intGravatar Mike Reed2017-08-09
| | | | | | | | | | rects are already auto-vectorized, so no need to explicitly write a 4f version of SkRect::round() Bug: skia: Change-Id: I098945767bfcaa7093d770c376bd17ff3bdc9983 Reviewed-on: https://skia-review.googlesource.com/32060 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
* clean up useage of SkFloatBitsGravatar Mike Reed2017-08-07
| | | | | | | | Bug: skia: Change-Id: I6d3a0019f2fcf11feca69123e4ce6eb35de43613 Reviewed-on: https://skia-review.googlesource.com/31222 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
* *SkTCast<int*>(float*) -> memcpyGravatar Mike Klein2016-09-29
| | | | | | | | | | | | | | | In some build configurations (I think, GN, GCC 6, Debug) I get a warning that i is used unintialized. This likely has something to do with GCC correctly seeing that the SkTCast construction there is illegal aliasing, and perhaps thus "doesn't happen". Might be that if the SkTCast gets inlined, it decides its implementation is secretly kosher, and so Release builds don't see this. None of this happens with the GCCs we have on the bots... too old? Instead use memcpy() here, which is well defined to do what we intended. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2758 Change-Id: Iaf5c75fbd852193b0b861bf5e71450502511d102 Reviewed-on: https://skia-review.googlesource.com/2758 Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* SkLeanWindows.h: #include "Windows.h" fewer placesGravatar halcanary2016-06-07
| | | | | | | | | | | | | | | | | | | | | | | | $ git grep -l '<windows.h>' include src include/private/SkLeanWindows.h $ git grep -l SkLeanWindows.h | grep '\.h$' include/ports/SkTypeface_win.h include/utils/win/SkHRESULT.h include/utils/win/SkTScopedComPtr.h include/views/SkEvent.h src/core/SkMathPriv.h src/ports/SkTypeface_win_dw.h src/utils/SkThreadUtils_win.h src/utils/win/SkWGL.h The same for `#include <intrin.h>` that was found in SkMath.h. Those functions that needed it are moved to SkMathPriv.h. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2041943002 CQ_INCLUDE_TRYBOTS=tryserver.chromium.win:win_chromium_compile_dbg_ng,win_chromium_compile_rel_ng Review-Url: https://codereview.chromium.org/2041943002
* Clean up SkFloatBitsGravatar mtklein2016-05-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - remove dead code - rewrite float -> int converters The strategy for the new converters is: - convert input to double - floor/ceil/round in double space - pin that double to [SK_MinS32, SK_MaxS32] - truncate that double to int32_t This simpler strategy does not work: - floor/ceil/round in float space - pin that float to [SK_MinS32, SK_MaxS32] - truncate that float to int32_t SK_MinS32 and SK_MaxS32 are not representable as floats: they round to the nearest float, ±2^31, which makes the pin insufficient for floats near SK_MinS32 (-2^31+1) or SK_MaxS32 (+2^31-1). float only has 24 bits of precision, and we need 31. double can represent all integers up to 50-something bits. An alternative is to pin in float to ±2147483520, the last exactly representable float before SK_MaxS32 (127 too small). Our tests test that we round as floor(x+0.5), which can return different numbers than round(x) for negative x. So this CL explicitly uses floor(x+0.5). I've updated the tests with ±inf and ±NaN, and tried to make them a little clearer, especially using SK_MinS32 instead of -SK_MaxS32. I have not timed anything here. I have never seen any of these methods in a profile. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2012333003 Review-Url: https://codereview.chromium.org/2012333003
* Reverse dependency between SkScalar.h and SkFixed.h.Gravatar benjaminwagner2016-04-07
| | | | | | | | | | | | | | | The following are unused in Chromium, Android, Mozilla, and Google3: - SkFixedToScalar - SkScalarToFixed The following are additionally unused in Skia: - SkStrAppendFixed - SkWriteBuffer::writeFixed BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1841123002 Review URL: https://codereview.chromium.org/1841123002
* spin off remaining integer overflow fixesGravatar mtklein2015-12-08
| | | | | | | | | | | - Carmack rsqrt uses an int where it wants a uint32_t. - turn off all santizers (including signed-integer-overflow) in third_party/externals/sftntly. CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-ASAN-Trybot BUG=skia:4635 Review URL: https://codereview.chromium.org/1511643002
* Remove const from `const int loops`.Gravatar mtklein2015-10-01
| | | | | | | | This drives me nuts, and prevents `while (loops --> 0)`. BUG=skia: Review URL: https://codereview.chromium.org/1379923005
* Style Change: NULL->nullptrGravatar halcanary2015-08-27
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316233002 Review URL: https://codereview.chromium.org/1316233002
* Fix up -Winconsistent-missing-overrideGravatar mtklein2015-07-13
| | | | | | | | | | | | | | (and a couple presubmit fixes) This allows us to turn back on -Werror for LLVM coverage builds, and more generally supports building with Clang 3.7. No public API changes. TBR=reed@google.com BUG=skia: Review URL: https://codereview.chromium.org/1232463006
* C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla}Gravatar mtklein2015-03-25
| | | | | | | | | NOPRESUBMIT=true BUG=skia: DOCS_PREVIEW= https://skia.org/?cl=1037793002 Review URL: https://codereview.chromium.org/1037793002
* Revert of replace SkFixedDiv impl with native 64bit math (patchset #2 ↵Gravatar reed2015-03-19
| | | | | | | | | | | | | | | | | | | | | | | | | id:20001 of https://codereview.chromium.org/1022543003/) Reason for revert: http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/53096 layouttests failures Original issue's description: > replace SkFixedDiv impl with native 64bit math > > BUG=skia: > TBR= > > Committed: https://skia.googlesource.com/skia/+/7c44ca926bf42b3b2e56131f250c0fd58f87ac71 TBR= NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1018523008
* replace SkFixedDiv impl with native 64bit mathGravatar reed2015-03-18
| | | | | | | BUG=skia: TBR= Review URL: https://codereview.chromium.org/1022543003
* Fix up all the easy virtual ... SK_OVERRIDE cases.Gravatar mtklein2015-01-09
| | | | | | | | | | | | This fixes every case where virtual and SK_OVERRIDE were on the same line, which should be the bulk of cases. We'll have to manually clean up the rest over time unless I level up in regexes. for f in (find . -type f); perl -p -i -e 's/virtual (.*)SK_OVERRIDE/\1SK_OVERRIDE/g' $f; end BUG=skia: Review URL: https://codereview.chromium.org/806653007
* Remove Sk prefix from some bench classes.Gravatar tfarina2014-06-19
| | | | | | | | | | | | | | | | This idea came while commenting on https://codereview.chromium.org/343583005/ Since SkBenchmark, SkBenchLogger and SkGMBench are not part of the Skia library, they should not have the Sk prefix. BUG=None TEST=make all R=mtklein@google.com Author: tfarina@chromium.org Review URL: https://codereview.chromium.org/347823004
* Simplify benchmark internal API.Gravatar commit-bot@chromium.org2013-12-03
| | | | | | | | | | | | | | | | | | I'm not quite sure why I wrote such a convoluted API with setLoops()/getLoops(). This replaces it with a loops argument passed to onDraw(). This CL is largely mechanical translation from the old API to the new one. MathBench used this->getLoops() outside onDraw(), which seems incorrect. I fixed it. BUG= R=djsollen@google.com Author: mtklein@google.com Review URL: https://codereview.chromium.org/99893003 git-svn-id: http://skia.googlecode.com/svn/trunk@12466 2bbb7eff-a529-9590-31e7-b0007b416f81
* Implement a benchmark for GrResourceCacheGravatar commit-bot@chromium.org2013-11-21
| | | | | | | | | | | | | | | | | | | | | | | Adds "grresourcecache_add" and "grresourcecache_find" bench tests to test GrResourceCache::add and GrResourceCache::find. The tests work only with GPU backends, since GrResourceCache needs an GrGpu. Modifies bench tests to override SkBenchmark::isSuitableFor(Backend) function that specifies what kind of backend the test is inteded for. This replaces the previous "fIsRendering" flag that would indicate test that did no rendering. Adds SkCanvas::getGrContext() call to get the GrContext that the canvas ends up drawing to. The member function solves a common use-case that is also used in the benchmark added here. R=mtklein@google.com, bsalomon@google.com Author: kkinnunen@nvidia.com Review URL: https://codereview.chromium.org/73643005 git-svn-id: http://skia.googlecode.com/svn/trunk@12334 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add sk_float_rsqrt with SSE + NEON fast paths.Gravatar commit-bot@chromium.org2013-11-08
| | | | | | | | | | | | | | | | | | | | | | | | | Current numbers: N4: running bench [640 480] math_fastIsqrt NONRENDERING: cmsecs = 3.12 running bench [640 480] math_slowIsqrt NONRENDERING: cmsecs = 4.82 running bench [640 480] math_sk_float_rsqrt NONRENDERING: cmsecs = 1.99 Desktop: running bench [640 480] math_fastIsqrt NONRENDERING: cmsecs = 0.89 running bench [640 480] math_slowIsqrt NONRENDERING: cmsecs = 0.94 running bench [640 480] math_sk_float_rsqrt NONRENDERING: cmsecs = 0.09 Haven't found any other benches where this is a significant effect yet. BUG= R=reed@google.com Author: mtklein@google.com Review URL: https://codereview.chromium.org/60083014 git-svn-id: http://skia.googlecode.com/svn/trunk@12203 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix asan build. Duh, don't return a stack address...Gravatar mtklein@google.com2013-09-27
| | | | | | | | | BUG= R=robertphillips@google.com Review URL: https://codereview.chromium.org/25026004 git-svn-id: http://skia.googlecode.com/svn/trunk@11497 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add SkDivMod with a special case for ARM.Gravatar commit-bot@chromium.org2013-09-26
| | | | | | | | | | | BUG=skia:1663 R=djsollen@google.com, tomhudson@google.com, reed@google.com Author: mtklein@google.com Review URL: https://chromiumcodereview.appspot.com/24159009 git-svn-id: http://skia.googlecode.com/svn/trunk@11482 2bbb7eff-a529-9590-31e7-b0007b416f81
* Refactoring: get rid of the SkBenchmark void* parameter.Gravatar mtklein@google.com2013-09-13
| | | | | | | | | | | While I was doing massive sed-ing, I also converted every bench to use DEF_BENCH instead of registering the ugly manual way. BUG= R=scroggo@google.com Review URL: https://codereview.chromium.org/23876006 git-svn-id: http://skia.googlecode.com/svn/trunk@11263 2bbb7eff-a529-9590-31e7-b0007b416f81
* Major bench refactoring.Gravatar mtklein@google.com2013-09-10
| | | | | | | | | | | | | - Use FLAGS_. - Remove outer repeat loop. - Tune inner loop automatically. BUG=skia:1590 R=epoger@google.com, scroggo@google.com Review URL: https://codereview.chromium.org/23478013 git-svn-id: http://skia.googlecode.com/svn/trunk@11187 2bbb7eff-a529-9590-31e7-b0007b416f81
* Change old PRG to be SkLCGRandom; change new one to SkRandomGravatar commit-bot@chromium.org2013-09-09
| | | | | | | | | | | | | | The goal here is to get people to start using the new random number generator, while leaving the old one in place so we don't have to rebaseline GMs. R=reed@google.com, bsalomon@google.com Author: jvanverth@google.com Review URL: https://chromiumcodereview.appspot.com/23576015 git-svn-id: http://skia.googlecode.com/svn/trunk@11169 2bbb7eff-a529-9590-31e7-b0007b416f81
* Switch out random number generator for tests, benches, samples.Gravatar commit-bot@chromium.org2013-09-06
| | | | | | | | | | | | This change makes tests, benches and samples use the new SkMWCRandom PRNG. GMs will be saved for another time, as they'll require rebaselining. R=reed@google.com, bsalomon@google.com Author: jvanverth@google.com Review URL: https://chromiumcodereview.appspot.com/23653018 git-svn-id: http://skia.googlecode.com/svn/trunk@11136 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert of r10671 (Experiments on calculating reciprocal of square root) due ↵Gravatar robertphillips@google.com2013-08-12
| | | | | | | | | | | | to bots failures: Win7: http://108.170.217.252:10117/builders/Build-Win7-VS2010-x86-Debug/builds/715/steps/BuildMost/logs/stdio Win8: http://108.170.217.252:10117/builders/Build-Win8-VS2012-x86-Debug/builds/383/steps/BuildMost/logs/stdio Mac10.6: http://108.170.217.252:10117/builders/Build-Mac10.6-GCC-x86-Debug/builds/1259/steps/BuildMost/logs/stdio git-svn-id: http://skia.googlecode.com/svn/trunk@10672 2bbb7eff-a529-9590-31e7-b0007b416f81
* Experiments on calculating reciprocal of square rootGravatar commit-bot@chromium.org2013-08-12
| | | | | | | | | | | BUG= R=reed@google.com, rmistry@chromium.org, bsalomon@google.com, tomhudson@chromium.org, tomhudson@google.com Author: yang.gu@intel.com Review URL: https://chromiumcodereview.appspot.com/21755002 git-svn-id: http://skia.googlecode.com/svn/trunk@10671 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add bench to test float to fixed conversionGravatar djsollen@google.com2013-07-18
| | | | | | | | R=reed@google.com Review URL: https://codereview.chromium.org/19773006 git-svn-id: http://skia.googlecode.com/svn/trunk@10155 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove unused NormalizeBench::fUsePortable field.Gravatar commit-bot@chromium.org2013-06-19
| | | | | | | | | | | | | | | | | To address build warnings: ../bench/MathBench.cpp:442:10: error: private field 'fUsePortable' is not used [-Werror,-Wunused-private-field] bool fUsePortable; ^ R=reed@google.com Author: fmalita@chromium.org Review URL: https://chromiumcodereview.appspot.com/17463002 git-svn-id: http://skia.googlecode.com/svn/trunk@9677 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Housekeeper-NightlyGravatar skia.committer@gmail.com2013-05-04
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@9002 2bbb7eff-a529-9590-31e7-b0007b416f81
* add bench for SkPoint::normalize()Gravatar reed@google.com2013-05-03
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8977 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Skia_Periodic_House_KeepingGravatar skia.committer@gmail.com2013-04-30
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8919 2bbb7eff-a529-9590-31e7-b0007b416f81
* up the inner-loop for clz bench, to get more stable resultsGravatar reed@google.com2013-04-29
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8895 2bbb7eff-a529-9590-31e7-b0007b416f81
* add bench for SkCLZGravatar reed@google.com2013-04-29
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8894 2bbb7eff-a529-9590-31e7-b0007b416f81
* use DEF_BENCH macroGravatar reed@google.com2013-04-29
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8893 2bbb7eff-a529-9590-31e7-b0007b416f81
* Bench : Unused parameters cleanupGravatar sugoi@google.com2013-03-05
| | | | | | | I removed unused parameters in bench wherever it was trivial to do so. Review URL: https://codereview.appspot.com/7411046 git-svn-id: http://skia.googlecode.com/svn/trunk@7988 2bbb7eff-a529-9590-31e7-b0007b416f81
* Suppress some warnings on linux.Gravatar bsalomon@google.com2012-09-26
| | | | | | | R=reed@google.com Review URL: https://codereview.appspot.com/6572046 git-svn-id: http://skia.googlecode.com/svn/trunk@5687 2bbb7eff-a529-9590-31e7-b0007b416f81
* Let SkBenchmark classes specify that they do no rendering.Gravatar tomhudson@google.com2012-09-13
| | | | | | | | | | | Doing this gives us a 15-20% speedup in bench cycle time. Here again I'm just picking the easy targets. http://codereview.appspot.com/6500115/ git-svn-id: http://skia.googlecode.com/svn/trunk@5525 2bbb7eff-a529-9590-31e7-b0007b416f81
* Result of running tools/sanitize_source_files.py (which was added in ↵Gravatar rmistry@google.com2012-08-23
| | | | | | | | | https://codereview.appspot.com/6465078/) This CL is part I of IV (I broke down the 1280 files into 4 CLs). Review URL: https://codereview.appspot.com/6485054 git-svn-id: http://skia.googlecode.com/svn/trunk@5262 2bbb7eff-a529-9590-31e7-b0007b416f81
* fix warnings on Mac in benchGravatar caryclark@google.com2012-06-06
| | | | | | | | | | | | | | | | | | Fix these class of warnings: - unused functions - unused locals - sign mismatch - missing function prototypes - missing newline at end of file - 64 to 32 bit truncation The changes prefer to link in dead code in the debug build with 'if (false)' than to comment it out, but trivial cases are commented out or sometimes deleted if it appears to be a copy/paste error. Review URL: https://codereview.appspot.com/6302044 git-svn-id: http://skia.googlecode.com/svn/trunk@4188 2bbb7eff-a529-9590-31e7-b0007b416f81
* apply 10.p+32 -> (float)(1 << 23) fix from MathTest here as wellGravatar reed@google.com2012-05-30
| | | | | | | | windows can't eat the former syntax git-svn-id: http://skia.googlecode.com/svn/trunk@4070 2bbb7eff-a529-9590-31e7-b0007b416f81
* add bench for floor variantsGravatar reed@google.com2012-05-30
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@4065 2bbb7eff-a529-9590-31e7-b0007b416f81
* Addressed more Windows compiler complaint issuesGravatar robertphillips@google.com2012-04-16
| | | | | | | | http://codereview.appspot.com/6007056/ git-svn-id: http://skia.googlecode.com/svn/trunk@3689 2bbb7eff-a529-9590-31e7-b0007b416f81
* rename sk_float_isNaN to sk_float_isnan to match related functionsGravatar reed@google.com2011-12-06
| | | | | | | | add sk_float_isinf returning non-zero if the argument is +/- infinity git-svn-id: http://skia.googlecode.com/svn/trunk@2813 2bbb7eff-a529-9590-31e7-b0007b416f81
* rename hasValidCoordinates to isFinite (on SkRect) and reimplement for speedGravatar reed@google.com2011-12-06
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@2811 2bbb7eff-a529-9590-31e7-b0007b416f81
* add bench for computing isfinite of 4 values (targeted for SkRect)Gravatar reed@google.com2011-12-05
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@2805 2bbb7eff-a529-9590-31e7-b0007b416f81
* In debug builds, only run each benchmark 1 time (test for assertion-breakage,Gravatar tomhudson@google.com2011-10-28
| | | | | | | | | not performance). codereview.appspot.com/5314064/ git-svn-id: http://skia.googlecode.com/svn/trunk@2552 2bbb7eff-a529-9590-31e7-b0007b416f81