Commit a60fdd50 authored by yiwenshao's avatar yiwenshao

add bench

parent 4e799185
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
int int
main(int argc,char**argv){ main(int argc,char**argv){
RAW_ASHE ashe(1); RAW_ASHE ashe(1);
int num_of_tests = 10000; int num_of_tests = 10000;
if(argc==2){ if(argc==2){
...@@ -23,21 +22,16 @@ main(int argc,char**argv){ ...@@ -23,21 +22,16 @@ main(int argc,char**argv){
std::cout<<"num_of_tests"<<std::endl; std::cout<<"num_of_tests"<<std::endl;
return 0; return 0;
} }
unsigned int pt = 1u;
unsigned int pt = 1u;
timer t; timer t;
std::pair<long,uint64_t> res; std::pair<long,uint64_t> res;
for(int i=0;i<num_of_tests;i++) { for(int i=0;i<num_of_tests;i++) {
res = ashe.encrypt(pt,0); res = ashe.encrypt(pt,0);
} }
std::cout<<"enc_ashe_in_us: "<<t.lap()*1.0/num_of_tests<<std::endl; std::cout<<"enc_ashe_in_us: "<<t.lap()*1.0/num_of_tests<<std::endl;
for(int i=0;i<num_of_tests;i++) { for(int i=0;i<num_of_tests;i++) {
ashe.decrypt(res.first,0); ashe.decrypt(res.first,0);
} }
std::cout<<"dec_ashe_in_us: "<<t.lap()*1.0/num_of_tests<<std::endl; std::cout<<"dec_ashe_in_us: "<<t.lap()*1.0/num_of_tests<<std::endl;
return 0; return 0;
} }
#include <vector>
#include "util/errstream.hh"
#include "crypto/search.hh"
static void
test_search(int num_of_tests,int len){
search_priv s("my key");
std::string input = std::string(len,'a');
auto cl = s.transform({"hexxxxxxxxxxxxxxxxxxxllo", "world", input});
std::cout<<cl.size()<<std::endl;
}
int main(){
test_search(10,8);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment