Cleaning.

This commit is contained in:
Daniel Lemire 2018-04-06 17:29:19 -04:00
parent 980f69dc67
commit 121f024be0
10 changed files with 28 additions and 7 deletions

View File

@ -1,6 +1,6 @@
HEADERS:=avxprocessing.h benchmark.h common_defs.h jsonstruct.h scalarprocessing.h util.h
bench: bench.cpp $(HEADERS)
$(CXX) -O3 -o $@ bench.cpp -march=native -lm -Wall -Wextra
HEADERS:=include/avxprocessing.h include/benchmark.h include/common_defs.h include/jsonstruct.h include/scalarprocessing.h include/util.h
bench: benchmarks/bench.cpp $(HEADERS)
$(CXX) -std=c++11 -O3 -o $@ benchmarks/bench.cpp -Iinclude -march=native -lm -Wall -Wextra
clean:
rm -f bench

3
scalarvssimd/README.md Normal file
View File

@ -0,0 +1,3 @@
```
./run.sh
```

View File

@ -21,7 +21,14 @@ int main(int argc, char * argv[]) {
}
pair<u8 *, size_t> p = get_corpus(argv[argc - 1]);
ParsedJson pj;
std::cout << "Input has "<< p.second << " bytes."<<std::endl;
std::cout << "Input has ";
if(p.second > 1024 * 1024)
std::cout << p.second / (1024*1024) << " MB ";
else if (p.second > 1024)
std::cout << p.second / 1024 << " KB ";
else
std::cout << p.second << " B ";
std::cout << std::endl;
if (posix_memalign( (void **)&pj.structurals, 8, ROUNDUP_N(p.second, 64)/8)) {
throw "Allocation failed";
@ -46,7 +53,7 @@ int main(int argc, char * argv[]) {
colorfuldisplay(pj, p.first);
debugdisplay(pj,p.first);
}
int repeat = 5;
int repeat = 10;
int volume = p.second;
BEST_TIME_NOCHECK(avx_json_parse(p.first, p.second, pj), , repeat, volume, true);
BEST_TIME_NOCHECK(scalar_json_parse(p.first, p.second, pj), , repeat, volume, true);

View File

@ -142,9 +142,9 @@ uint64_t global_rdtsc_overhead = (uint64_t)UINT64_MAX;
float cycle_per_op = (min_diff) / (double)S; \
float avg_cycle_per_op = (sum_diff) / ((double)S * repeat); \
if (verbose) \
printf(" %.3f %s per operation (best) ", cycle_per_op, unitname); \
printf(" %.3f %s per input byte (best) ", cycle_per_op, unitname); \
if (verbose) \
printf(" %.3f %s per operation (avg) ", avg_cycle_per_op, unitname); \
printf(" %.3f %s per input byte (avg) ", avg_cycle_per_op, unitname); \
if (verbose) \
printf("\n"); \
if (!verbose) \

11
scalarvssimd/run.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
cd $SCRIPTPATH
make bench
echo
for i in $SCRIPTPATH/../jsonexamples/*.json; do
[ -f "$i" ] || break
echo $i
$SCRIPTPATH/bench $i
echo
done