fix(bench): measure constant-size v2 read lookup
This commit is contained in:
@@ -1801,7 +1801,7 @@ static int test_binary_v2_file_benchmark(test_context_t *context)
|
|||||||
{
|
{
|
||||||
unsigned int scale = benchmark_scales[sample_index];
|
unsigned int scale = benchmark_scales[sample_index];
|
||||||
unsigned int iterations = (scale <= 4u) ? benchmark_iterations_small : ((scale <= 16u) ? benchmark_iterations_medium : benchmark_iterations_large);
|
unsigned int iterations = (scale <= 4u) ? benchmark_iterations_small : ((scale <= 16u) ? benchmark_iterations_medium : benchmark_iterations_large);
|
||||||
unsigned int expected_inventory_size = (scale * 8u < 5u) ? 5u : (scale * 8u);
|
int64_t expected_count_value = 1337;
|
||||||
ikv_node_t *root = create_benchmark_root(scale);
|
ikv_node_t *root = create_benchmark_root(scale);
|
||||||
double total_index_us = 0.0;
|
double total_index_us = 0.0;
|
||||||
double total_read_us = 0.0;
|
double total_read_us = 0.0;
|
||||||
@@ -1837,7 +1837,7 @@ static int test_binary_v2_file_benchmark(test_context_t *context)
|
|||||||
for (unsigned int i = 0; result == 0 && i < iterations; ++i)
|
for (unsigned int i = 0; result == 0 && i < iterations; ++i)
|
||||||
{
|
{
|
||||||
ikv_node_t *loaded = benchmark_parse_file(format, path);
|
ikv_node_t *loaded = benchmark_parse_file(format, path);
|
||||||
ikv_node_t *inventory = NULL;
|
ikv_node_t *count = NULL;
|
||||||
double start_time = 0.0;
|
double start_time = 0.0;
|
||||||
double end_time = 0.0;
|
double end_time = 0.0;
|
||||||
|
|
||||||
@@ -1848,11 +1848,11 @@ static int test_binary_v2_file_benchmark(test_context_t *context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
start_time = benchmark_now_us();
|
start_time = benchmark_now_us();
|
||||||
inventory = ikv_object_get(loaded, "inventory");
|
count = ikv_object_get(loaded, "count");
|
||||||
end_time = benchmark_now_us();
|
end_time = benchmark_now_us();
|
||||||
|
|
||||||
if ((result = expect_true(context, inventory != NULL, "benchmark read inventory lookup failed")) == 0 &&
|
if ((result = expect_true(context, count != NULL, "benchmark read count lookup failed")) == 0 &&
|
||||||
(result = expect_true(context, ikv_array_size(inventory) == expected_inventory_size, "benchmark read inventory size mismatch")) == 0)
|
(result = expect_true(context, ikv_as_int(count) == expected_count_value, "benchmark read count value mismatch")) == 0)
|
||||||
{
|
{
|
||||||
total_read_us += end_time - start_time;
|
total_read_us += end_time - start_time;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user