add deque to array alloc benchmark
This commit is contained in:
parent
12eb56d96a
commit
0c8c55031a
1 changed files with 32 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include "bench_framework.hpp"
|
#include "bench_framework.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <deque>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <valarray>
|
#include <valarray>
|
||||||
|
@ -203,6 +204,33 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class test3d : public benchmark::test_case
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
uint32_t size_;
|
||||||
|
std::vector<uint8_t> array_;
|
||||||
|
test3d(mapnik::parameters const& params)
|
||||||
|
: test_case(params),
|
||||||
|
size_(*params.get<mapnik::value_integer>("size",256*256)),
|
||||||
|
array_(size_,0) { }
|
||||||
|
bool validate() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool operator()() const
|
||||||
|
{
|
||||||
|
for (std::size_t i=0;i<iterations_;++i) {
|
||||||
|
std::deque<uint8_t> data(size_);
|
||||||
|
for (std::size_t i=0;i<size_;++i) {
|
||||||
|
if (data[i] != 0) {
|
||||||
|
throw std::runtime_error("found non zero value");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class test4 : public benchmark::test_case
|
class test4 : public benchmark::test_case
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -365,6 +393,10 @@ int main(int argc, char** argv)
|
||||||
test3c test_runner(params);
|
test3c test_runner(params);
|
||||||
run(test_runner,"vector/assign");
|
run(test_runner,"vector/assign");
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
test3d test_runner(params);
|
||||||
|
run(test_runner,"deque(N)");
|
||||||
|
}
|
||||||
{
|
{
|
||||||
test5 test_runner(params);
|
test5 test_runner(params);
|
||||||
run(test_runner,"std::string range");
|
run(test_runner,"std::string range");
|
||||||
|
|
Loading…
Reference in a new issue