File indexing completed on 2024-11-10 04:00:28

0001 /*
0002  *  SPDX-FileCopyrightText: 2010 Cyrille Berger <cberger@cberger.net>
0003  *
0004  *  SPDX-License-Identifier: LGPL-2.1-or-later
0005  */
0006 
0007 #include "kis_fast_math_benchmark.h"
0008 
0009 #include <simpletest.h>
0010 
0011 #include <kis_fast_math.h>
0012 
0013 const int COUNT = 1000;
0014 
0015 void KisFastMathBenchmark::benchmarkFastAtan2()
0016 {
0017     QBENCHMARK{
0018         for (int i = 0 ; i < COUNT; ++i) {
0019             double x = i;
0020             for (int j = 0 ; j < COUNT; ++j) {
0021 
0022                 double y = j;
0023 
0024                 KisFastMath::atan2(y, x);
0025             }
0026         }
0027     }
0028 }
0029 
0030 void KisFastMathBenchmark::benchmarkLibCAtan2()
0031 {
0032     QBENCHMARK{
0033         for (int i = 0 ; i < COUNT; ++i) {
0034             double x = i;
0035             for (int j = 0 ; j < COUNT; ++j) {
0036 
0037                 double y = j;
0038 
0039                 double result = atan2(y, x);
0040                 Q_UNUSED(result);
0041             }
0042         }
0043     }
0044 }
0045 
0046 SIMPLE_TEST_MAIN(KisFastMathBenchmark)
0047