More threadpool bs
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "EngineTest.h"
|
||||
#include "Containers/Array.h"
|
||||
#include "MinimalEngine.h"
|
||||
#include <algorithm>
|
||||
#include <time.h>
|
||||
#include <chrono>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
@@ -138,56 +139,6 @@ BOOST_AUTO_TEST_CASE(refptr_interaction)
|
||||
}
|
||||
}
|
||||
|
||||
/*BOOST_AUTO_TEST_CASE(benchmark)
|
||||
{
|
||||
using namespace std::chrono;
|
||||
srand(time(NULL));
|
||||
const uint32 TEST_SIZE = 1024 * 256;
|
||||
uint32* testSet = new uint32[TEST_SIZE];
|
||||
#pragma loop( hint_parallel( 0 ) )
|
||||
for (int i = 0; i < TEST_SIZE; ++i)
|
||||
{
|
||||
testSet[i] = rand();
|
||||
}
|
||||
high_resolution_clock::time_point start_vector = high_resolution_clock::now();
|
||||
std::vector<uint32> vec;
|
||||
for (int i = 0; i < TEST_SIZE; ++i)
|
||||
{
|
||||
vec.push_back(testSet[i]);
|
||||
}
|
||||
high_resolution_clock::time_point end_vector = high_resolution_clock::now();
|
||||
float time_vector = duration_cast<milliseconds>(end_vector - start_vector).count();
|
||||
|
||||
std::random_shuffle(testSet, testSet + TEST_SIZE);
|
||||
high_resolution_clock::time_point start_remove_vector = high_resolution_clock::now();
|
||||
for (int i = 0; i < TEST_SIZE; ++i)
|
||||
{
|
||||
vec.erase(std::find(vec.begin(), vec.end(), testSet[i]));
|
||||
}
|
||||
high_resolution_clock::time_point end_remove_vector = high_resolution_clock::now();
|
||||
float remove_vector = duration_cast<milliseconds>(end_remove_vector - start_remove_vector).count();
|
||||
|
||||
high_resolution_clock::time_point start_array = high_resolution_clock::now();
|
||||
Array<uint32> arr;
|
||||
for (int i = 0; i < TEST_SIZE; ++i)
|
||||
{
|
||||
arr.add(testSet[i]);
|
||||
}
|
||||
high_resolution_clock::time_point end_array = high_resolution_clock::now();
|
||||
float time_array = duration_cast<milliseconds>(end_array - start_array).count();
|
||||
|
||||
high_resolution_clock::time_point start_remove_array = high_resolution_clock::now();
|
||||
for (int i = 0; i < TEST_SIZE; ++i)
|
||||
{
|
||||
arr.remove(arr.find(testSet[i]), false);
|
||||
}
|
||||
high_resolution_clock::time_point end_remove_array = high_resolution_clock::now();
|
||||
float remove_array = duration_cast<milliseconds>(end_remove_array - start_remove_array).count();
|
||||
std::cout << "Vector: " << time_vector << "ms Array: " << time_array << "ms" << std::endl;
|
||||
std::cout << "Vector remove: " << remove_vector << "ms Array remove: " << remove_array << "ms" << std::endl;
|
||||
delete[] testSet;
|
||||
}*/
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ BOOST_AUTO_TEST_CASE(insert_find_basic)
|
||||
map[4] = 4;
|
||||
BOOST_REQUIRE_EQUAL(map[2], 5);
|
||||
BOOST_REQUIRE_EQUAL(map[4], 4);
|
||||
BOOST_REQUIRE_EQUAL(map.find(2)->value, 5);
|
||||
BOOST_REQUIRE_EQUAL(map.find(4)->value, 4);
|
||||
//BOOST_REQUIRE_EQUAL(map.find(5), map.end());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(for_each)
|
||||
|
||||
Reference in New Issue
Block a user