Skip to content
Snippets Groups Projects
Commit 26bf1cbc authored by Ilya Verbin's avatar Ilya Verbin Committed by Serge Petrenko
Browse files

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
parent e3209ebd
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment