Browse Source

feat: try different stl containers

legacy
Dnomd343 2 years ago
parent
commit
0bdb34ddb9
  1. 13
      src/analyse/analyse.cc
  2. 9
      src/analyse/analyse.h

13
src/analyse/analyse.cc

@ -24,7 +24,10 @@ void Analyse::start_analyse(uint64_t code) {
.code = code, .code = code,
.mask = 0, .mask = 0,
.step = 0, .step = 0,
.src = std::move(std::set<analyse_t*>{}), // .src = std::move(std::vector<analyse_t*>{}),
.src = std::move(std::list<analyse_t*>{}),
// .src = std::move(std::set<analyse_t*>{}),
// .src = std::move(std::unordered_set<analyse_t*>{}),
}).first->second); }).first->second);
// std::cout << "src size: " << cases[code].src.size() << std::endl; // std::cout << "src size: " << cases[code].src.size() << std::endl;
@ -47,7 +50,8 @@ void Analyse::new_case(uint64_t code, uint64_t mask) {
// current->second.src.emplace() // current->second.src.emplace()
if (current->second.step != cache.front()->step) { if (current->second.step != cache.front()->step) {
current->second.src.emplace(cache.front()); // current->second.src.emplace(cache.front());
current->second.src.push_back(cache.front());
} }
return; return;
@ -57,6 +61,9 @@ void Analyse::new_case(uint64_t code, uint64_t mask) {
.code = code, .code = code,
.mask = mask, .mask = mask,
.step = cache.front()->step + 1, .step = cache.front()->step + 1,
.src = std::move(std::set<analyse_t*>{cache.front()}), // .src = std::move(std::vector<analyse_t*>{cache.front()}),
.src = std::move(std::list<analyse_t*>{cache.front()}),
// .src = std::move(std::set<analyse_t*>{cache.front()}),
// .src = std::move(std::unordered_set<analyse_t*>{cache.front()}),
}).first->second); }).first->second);
} }

9
src/analyse/analyse.h

@ -6,6 +6,7 @@
#include <set> #include <set>
#include <list> #include <list>
#include <unordered_set>
class Analyse { class Analyse {
public: public:
@ -14,9 +15,11 @@ public:
uint64_t mask; uint64_t mask;
int step; int step;
// TODO: try set / unordered_set
// std::list<analyse_t*> src; // std::vector<analyse_t*> src;
std::set<analyse_t*> src; std::list<analyse_t*> src;
// std::set<analyse_t*> src;
// std::unordered_set<analyse_t*> src;
}; };
std::queue<analyse_t*> cache; std::queue<analyse_t*> cache;

Loading…
Cancel
Save