| 60 | } |
| 61 | |
| 62 | static __attribute__((noinline)) benchmark::BenchmarkReporter::Run |
| 63 | bench_encode_chimp(alp_bench::ALPColumnDescriptor& dataset, |
| 64 | alp_bench::ChimpCompressionState<uint64_t, false> state, |
| 65 | uint8_t* data_arr, |
| 66 | uint8_t* flags_arr, |
| 67 | uint8_t* leading_zero_arr, |
| 68 | uint64_t* uint64_p, |
| 69 | double* dbl_arr) { |
| 70 | |
| 71 | int benchmark_number = dataset.id; |
| 72 | |
| 73 | #ifdef NDEBUG |
| 74 | uint64_t iterations = 300000; |
| 75 | #else |
| 76 | uint64_t iterations = 1; |
| 77 | #endif |
| 78 | |
| 79 | std::string benchmark_name = dataset.name + "_encode"; |
| 80 | |
| 81 | uint64_t cycles = benchmark::cycleclock::Now(); |
| 82 | for (uint64_t j = 0; j < iterations; ++j) { |
| 83 | // Init Encoding |
| 84 | state.Reset(); |
| 85 | state.output.SetStream(data_arr); |
| 86 | state.leading_zero_buffer.SetBuffer(leading_zero_arr); |
| 87 | state.flag_buffer.SetBuffer(flags_arr); |
| 88 | |
| 89 | /* |
| 90 | * |
| 91 | * Encode |
| 92 | * |
| 93 | */ |
| 94 | uint64_p = reinterpret_cast<uint64_t*>(dbl_arr); |
| 95 | for (size_t i {0}; i < 1024; ++i) { |
| 96 | alp_bench::ChimpCompression<uint64_t, false>::Store(uint64_p[i], state); |
| 97 | } |
| 98 | |
| 99 | state.Flush(); |
| 100 | state.output.Flush(); |
| 101 | } |
| 102 | |
| 103 | cycles = benchmark::cycleclock::Now() - cycles; |
| 104 | |
| 105 | return benchmark::BenchmarkReporter::Run( |
| 106 | benchmark_number, benchmark_name, iterations, double(cycles) / (double(iterations) * 1024)); |
| 107 | } |
| 108 | |
| 109 | void benchmark_all(benchmark::Benchmark& benchmark) { |
| 110 | uint8_t* data_arr; |