- Improved overall execution time of unit tests #396

This commit is contained in:
Christophe Riccio 2015-09-06 22:22:20 +02:00
parent 72d9e61d67
commit 47c77475a9
7 changed files with 30 additions and 31 deletions

View file

@ -55,6 +55,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
##### Improvements:
- Improved constexpr for constant functions coverage #198
- Added to_string for quat and dual_quat in GTX_string_cast #375
- Improved overall execution time of unit tests #396
##### Fixes:
- Fixed strict alignment warnings #235 #370

View file

@ -996,11 +996,11 @@ namespace sign
return Error;
}
int perf_rand()
int perf_rand(std::size_t Samples)
{
int Error = 0;
std::size_t const Count = 100000000;
std::size_t const Count = Samples;
std::vector<glm::int32> Input, Output;
Input.resize(Count);
Output.resize(Count);
@ -1049,11 +1049,11 @@ namespace sign
return Error;
}
int perf_linear()
int perf_linear(std::size_t Samples)
{
int Error = 0;
std::size_t const Count = 10000000;
std::size_t const Count = Samples;
std::vector<glm::int32> Input, Output;
Input.resize(Count);
Output.resize(Count);
@ -1096,11 +1096,11 @@ namespace sign
return Error;
}
int perf_linear_cal()
int perf_linear_cal(std::size_t Samples)
{
int Error = 0;
glm::uint32 const Count = 10000000;
glm::uint32 const Count = Samples;
std::clock_t Timestamp0 = std::clock();
glm::int32 Sum = 0;
@ -1141,13 +1141,13 @@ namespace sign
return Error;
}
int perf()
int perf(std::size_t Samples)
{
int Error(0);
Error += perf_linear_cal();
Error += perf_linear();
Error += perf_rand();
Error += perf_linear_cal(Samples);
Error += perf_linear(Samples);
Error += perf_rand(Samples);
return Error;
}
@ -1173,7 +1173,8 @@ int main()
Error += isinf_::test();
# ifdef NDEBUG
Error += sign::perf();
std::size_t Samples = 1000;
Error += sign::perf(Samples);
# endif
return Error;

View file

@ -669,7 +669,7 @@ namespace findMSB
return 31 - glm::bitCount(~x);
}
int perf_int()
int perf_int(std::size_t Count)
{
type<int, int> const Data[] =
{
@ -711,7 +711,6 @@ namespace findMSB
};
int Error(0);
std::size_t const Count(10000000);
std::clock_t Timestamps0 = std::clock();
@ -947,11 +946,11 @@ namespace findMSB
return Error;
}
int perf()
int perf(std::size_t Samples)
{
int Error(0);
Error += perf_int();
Error += perf_int(Samples);
return Error;
}
@ -1075,10 +1074,9 @@ namespace findLSB
return Error;
}
int perf_int()
int perf_int(std::size_t Count)
{
int Error(0);
std::size_t const Count(10000000);
std::clock_t Timestamps0 = std::clock();
@ -1142,11 +1140,11 @@ namespace findLSB
return Error;
}
int perf()
int perf(std::size_t Samples)
{
int Error(0);
Error += perf_int();
Error += perf_int(Samples);
return Error;
}
@ -1579,8 +1577,8 @@ int main()
std::size_t const Samples = 1000;
::bitCount::perf(Samples);
::bitfieldReverse::perf(Samples);
::findMSB::perf();
::findLSB::perf();
::findMSB::perf(Samples);
::findLSB::perf(Samples);
# endif
return Error;

View file

@ -304,7 +304,7 @@ int main()
0x40000000,30, 0x80000000,31, 0xFFFFFFF0,4, 0x3000FF00,8,
0xC0000000,30, 0x60000000,29, 0x00011000, 12};
std::size_t const Count = 10000000;
std::size_t const Count = 1000;
n = sizeof(test)/4;

View file

@ -342,7 +342,7 @@ int main()
0x4000000,5, 0x8000000,4, 0x0FFFFFFF,4, 0x10000000,3,
0x3000FFFF,2, 0x50003333,1, 0x7FFFFFFF,1, 0x80000000,0,
0xFFFFFFFF,0};
std::size_t const Count = 10000000;
std::size_t const Count = 1000;
n = sizeof(test)/4;

View file

@ -207,10 +207,8 @@ int test_inverse()
return Failed;
}
std::size_t const Count(10000000);
template <typename VEC3, typename MAT4>
int test_inverse_perf(std::size_t Instance, char const * Message)
int test_inverse_perf(std::size_t Count, std::size_t Instance, char const * Message)
{
std::vector<MAT4> TestInputs;
TestInputs.resize(Count);
@ -264,10 +262,11 @@ int main()
Error += test_inverse();
# ifdef NDEBUG
std::size_t const Samples(1000);
for(std::size_t i = 0; i < 1; ++i)
{
Error += test_inverse_perf<glm::vec3, glm::mat4>(i, "mat4");
Error += test_inverse_perf<glm::dvec3, glm::dmat4>(i, "dmat4");
Error += test_inverse_perf<glm::vec3, glm::mat4>(Samples, i, "mat4");
Error += test_inverse_perf<glm::dvec3, glm::dmat4>(Samples, i, "dmat4");
}
# endif//NDEBUG

View file

@ -83,10 +83,9 @@ namespace log2_
return Error;
}
int perf()
int perf(std::size_t Count)
{
int Error = 0;
std::size_t const Count(100000000);
{
std::vector<int> Result;
@ -218,7 +217,8 @@ int main()
Error += ::log2_::test();
# ifdef NDEBUG
Error += ::log2_::perf();
std::size_t const Samples(1000);
Error += ::log2_::perf(Samples);
# endif//NDEBUG
return Error;