box: speed up required fields check in tuple_new()
If the number of tuple fields is less than `format->min_field_count`, then some required field is missed, i.e., there is no need to update the `required_fields` bitmap during msgpack decoding. This optimization is valid only if tuple format doesn't contain fields accessed by JSON paths. This patch improves bench_tuple_new by 15-50%, depending on field count. NO_WRAP $ taskset 0x2 ~/benchmark/tools/compare.py benchmarks \ ./tuple.perftest.old ./tuple.perftest.new \ --benchmark_min_warmup_time=10 \ --benchmark_repetitions=30 \ --benchmark_report_aggregates_only=true \ --benchmark_filter=tuple_new [...] Comparing ./tuple.perftest.old to ./tuple.perftest.new Benchmark Time CPU Time Old Time New CPU Old CPU New ------------------------------------------------------------------------------------------------------------------------------------ bench_tuple_new<FORMAT_BASIC>_mean -0.1469 -0.1470 126 107 126 107 bench_tuple_new<FORMAT_BASIC>_median -0.1428 -0.1429 124 106 124 106 bench_tuple_new<FORMAT_BASIC>_stddev +0.0589 +0.0600 4 5 4 5 bench_tuple_new<FORMAT_BASIC>_cv +0.2412 +0.2427 0 0 0 0 bench_tuple_new<FORMAT_SPARSE>_mean -0.3754 -0.3753 3104 1939 3104 1939 bench_tuple_new<FORMAT_SPARSE>_median -0.3749 -0.3747 3071 1920 3071 1920 bench_tuple_new<FORMAT_SPARSE>_stddev -0.3482 -0.3482 85 55 85 55 bench_tuple_new<FORMAT_SPARSE>_cv +0.0434 +0.0434 0 0 0 0 NO_WRAP Needed for tarantool/tarantool-ee#711 NO_DOC=perf improvement
Showing
- changelogs/unreleased/box-speed-up-tuple_new.md 3 additions, 0 deletionschangelogs/unreleased/box-speed-up-tuple_new.md
- src/box/tuple_format.c 21 additions, 28 deletionssrc/box/tuple_format.c
- test/box/alter.result 14 additions, 0 deletionstest/box/alter.result
- test/box/alter.test.lua 5 additions, 0 deletionstest/box/alter.test.lua
- test/box/ddl_collation.result 4 additions, 4 deletionstest/box/ddl_collation.result
- test/box/ddl_collation.test.lua 4 additions, 4 deletionstest/box/ddl_collation.test.lua
Loading
Please register or sign in to comment