mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
37 lines
1.4 KiB
C++
37 lines
1.4 KiB
C++
#include "benchmarks.hpp"
|
|
#include <iostream>
|
|
#include <string>
|
|
#include <string.h>
|
|
#include <time.h>
|
|
#include <functional>
|
|
#include <vector>
|
|
#include <memory>
|
|
|
|
#define MAX_LOOPS 500000000
|
|
#define MAX_MATCHES 10
|
|
|
|
int main(){
|
|
std::function<void(int,int,int,bool)> functions[] = { shufti_benchmarks, rshufti_benchmarks, truffle_benchmarks, rtruffle_benchmarks };
|
|
int sizes[] = { 16000, 32000, 64000, 120000, 1600000, 2000000, 2500000, 3500000, 150000000, 250000000, 350000000, 500000000 };
|
|
const char charset[] = "aAaAaAaAAAaaaaAAAAaaaaAAAAAAaaaAAaaa";
|
|
for (size_t i = 0; i < std::size(sizes); i++) {
|
|
for(size_t j = 0; j < std::size(functions); j++) {
|
|
functions[j](sizes[i], MAX_LOOPS / sizes[i], MAX_MATCHES, false);
|
|
functions[j](sizes[i], MAX_LOOPS / sizes[i], MAX_MATCHES, true);
|
|
}
|
|
}
|
|
for(size_t i=0; i < std::size(sizes); i++){
|
|
//we imitate the noodle unit tests
|
|
for (int char_len = 1; char_len < 9; char_len++) {
|
|
std::unique_ptr<char []> str ( new char[char_len] );
|
|
for (int j=0; j<char_len; j++) {
|
|
srand (time(NULL));
|
|
int key = rand() % + 36 ;
|
|
str[char_len] = charset[key];
|
|
str[char_len + 1] = '\0';
|
|
}
|
|
noodle_benchmarks(sizes[i], MAX_LOOPS / sizes[i], str.get(), char_len, 0);
|
|
}
|
|
}
|
|
return 0;
|
|
} |