|
|
@ -697,55 +697,102 @@ struct alloc_bench_test : public test_scaffold { |
|
|
|
|
|
|
|
virtual int run() { |
|
|
|
int res = 0; |
|
|
|
auto store = std::make_unique<std::array<char, 1 << 16>>(); |
|
|
|
using buddy_loc = gp::buddy<>; |
|
|
|
using arena_loc = gp::arena<>; |
|
|
|
buddy_loc bud{&*store->begin(), store->size()}; |
|
|
|
arena_loc are{&*store->begin(), store->size()}; |
|
|
|
|
|
|
|
|
|
|
|
for(size_t divider = 2; divider < 32; ++divider) |
|
|
|
{ |
|
|
|
gp::ring_list<int, buddy_loc> a{bud}; |
|
|
|
gp::ring_list<int, arena_loc> b{are}; |
|
|
|
|
|
|
|
std::cout << |
|
|
|
"ARE | " << "INS | " << divider << " | " << |
|
|
|
time_operation([&](){ |
|
|
|
for(size_t i = 0; i < store->size()/sizeof(gp::ring_list<int, arena_loc>::node)/divider; i++) { |
|
|
|
b.insert(i); |
|
|
|
} |
|
|
|
}).count() << std::endl; |
|
|
|
|
|
|
|
std::cout << |
|
|
|
"ARE | " << "DEL | " << divider << " | " << |
|
|
|
time_operation([&](){ |
|
|
|
for(size_t i = 0; i < store->size()/sizeof(gp::ring_list<int, arena_loc>::node)/divider; i++) { |
|
|
|
gp::ring_list<int, arena_loc>::explorer e = b.explore(); |
|
|
|
b.remove(e); |
|
|
|
} |
|
|
|
}).count() << std::endl; |
|
|
|
if(do_bench) { |
|
|
|
auto store = std::make_unique<std::array<char, 1 << 16>>(); |
|
|
|
using buddy_loc = gp::buddy<>; |
|
|
|
using arena_loc = gp::arena<>; |
|
|
|
buddy_loc bud{&*store->begin(), store->size()}; |
|
|
|
arena_loc are{&*store->begin(), store->size()}; |
|
|
|
|
|
|
|
std::cout << "Allocator | Operation | Divider | Time (µs)" << std::endl; |
|
|
|
|
|
|
|
for(size_t divider = 2; divider < 32; ++divider) |
|
|
|
{ |
|
|
|
gp::ring_list<int, buddy_loc> a{bud}; |
|
|
|
gp::ring_list<int, arena_loc> b{are}; |
|
|
|
|
|
|
|
std::cout << |
|
|
|
"ARE | " << "INS | " << divider << " | " << |
|
|
|
time_operation([&](){ |
|
|
|
for(size_t i = 0; i < store->size()/sizeof(gp::ring_list<int, arena_loc>::node)/divider; i++) { |
|
|
|
b.insert(i); |
|
|
|
} |
|
|
|
}).count() << std::endl; |
|
|
|
|
|
|
|
std::cout << |
|
|
|
"ARE | " << "DEL | " << divider << " | " << |
|
|
|
time_operation([&](){ |
|
|
|
for(size_t i = 0; i < store->size()/sizeof(gp::ring_list<int, arena_loc>::node)/divider; i++) { |
|
|
|
gp::ring_list<int, arena_loc>::explorer e = b.explore(); |
|
|
|
b.remove(e); |
|
|
|
} |
|
|
|
}).count() << std::endl; |
|
|
|
|
|
|
|
std::cout << |
|
|
|
"BUD | " << "INS | " << divider << " | " << |
|
|
|
time_operation([&](){ |
|
|
|
for(size_t i = 0; i < store->size()/sizeof(gp::ring_list<int, buddy_loc>::node)/divider; i++) { |
|
|
|
std::cout << |
|
|
|
"BUD | " << "INS | " << divider << " | " << |
|
|
|
time_operation([&](){ |
|
|
|
for(size_t i = 0; i < store->size()/sizeof(gp::ring_list<int, buddy_loc>::node)/divider; i++) { |
|
|
|
a.insert(i); |
|
|
|
} |
|
|
|
}).count() << std::endl; |
|
|
|
|
|
|
|
std::cout << |
|
|
|
"BUD | " << "DEL | " << divider << " | " << |
|
|
|
time_operation([&](){ |
|
|
|
for(size_t i = 0; i < store->size()/sizeof(gp::ring_list<int, buddy_loc>::node)/divider; i++) { |
|
|
|
gp::ring_list<int, buddy_loc>::explorer e = a.explore(); |
|
|
|
a.remove(e); |
|
|
|
} |
|
|
|
}).count() << std::endl; |
|
|
|
} |
|
|
|
{ |
|
|
|
gp::ring_list<int, buddy_loc> a{bud}; |
|
|
|
gp::ring_list<int, arena_loc> b{are}; |
|
|
|
|
|
|
|
for(size_t i = 0; i < store->size()/sizeof(gp::ring_list<int, buddy_loc>::node)/2; i++) { |
|
|
|
a.insert(i); |
|
|
|
} |
|
|
|
}).count() << std::endl; |
|
|
|
|
|
|
|
std::cout << |
|
|
|
"BUD | " << "DEL | " << divider << " | " << |
|
|
|
time_operation([&](){ |
|
|
|
for(size_t i = 0; i < store->size()/sizeof(gp::ring_list<int, buddy_loc>::node)/divider; i++) { |
|
|
|
for(size_t i = 0; i < store->size()/sizeof(gp::ring_list<int, buddy_loc>::node)/2; i++) { |
|
|
|
gp::ring_list<int, buddy_loc>::explorer e = a.explore(); |
|
|
|
a.remove(e); |
|
|
|
a.remove(++e); |
|
|
|
} |
|
|
|
}).count() << std::endl; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return res; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
append_test dummy_jhgspo5d5(new alloc_bench_test{}); |
|
|
|
append_test dummy_jhgspo5d5(new alloc_bench_test{}); |
|
|
|
|
|
|
|
struct indexed_array_stair_test : public test_scaffold { |
|
|
|
indexed_array_stair_test() { |
|
|
|
name = __FILE__ ":13"; |
|
|
|
} |
|
|
|
|
|
|
|
virtual int run() { |
|
|
|
int res = 0; |
|
|
|
{ |
|
|
|
int climb = 0; |
|
|
|
int curr_climb = 0; |
|
|
|
gp::indexed_array<int, 1024> arr; |
|
|
|
while(climb < 1000) |
|
|
|
{ |
|
|
|
for(; curr_climb < 10; climb++, curr_climb++ ) |
|
|
|
{ |
|
|
|
arr.push(climb); |
|
|
|
} |
|
|
|
|
|
|
|
for(; curr_climb != 0; curr_climb -= 2) { |
|
|
|
arr.pop(arr.size() - curr_climb); |
|
|
|
} |
|
|
|
|
|
|
|
arr.pop(arr.size() - 1); |
|
|
|
} |
|
|
|
} |
|
|
|
return res; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
append_test dummy_amf763ld5(new indexed_array_stair_test{}); |