mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
schema: cache is_atomic() in column_definition
is_atomic() is called for each cell in mutation applies, compaction
and query. Since the value doesn't change it can be easily cached which
would save one indirection and virtual call.
Results of perf_simple_query -c1 (median, duration 60):
before after
read 54611.49 55396.01 +1.44%
write 65378.92 68554.25 +4.86%
Signed-off-by: Paweł Dziepak <pdziepak@scylladb.com>
Message-Id: <1465991045-11140-1-git-send-email-pdziepak@scylladb.com>
This commit is contained in:
committed by
Avi Kivity
parent
4def1f4524
commit
c8e75d2e84
@@ -325,7 +325,7 @@ index_info::index_info(::index_type idx_type,
|
||||
{}
|
||||
|
||||
column_definition::column_definition(bytes name, data_type type, column_kind kind, column_id component_index, index_info idx, api::timestamp_type dropped_at)
|
||||
: _name(std::move(name)), _dropped_at(dropped_at), type(std::move(type)), id(component_index), kind(kind), idx_info(std::move(idx))
|
||||
: _name(std::move(name)), _dropped_at(dropped_at), _is_atomic(type->is_atomic()), type(std::move(type)), id(component_index), kind(kind), idx_info(std::move(idx))
|
||||
{}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const column_definition& cd) {
|
||||
|
||||
@@ -196,6 +196,7 @@ public:
|
||||
private:
|
||||
bytes _name;
|
||||
api::timestamp_type _dropped_at;
|
||||
bool _is_atomic;
|
||||
|
||||
struct thrift_bits {
|
||||
thrift_bits()
|
||||
@@ -228,7 +229,7 @@ public:
|
||||
bool is_partition_key() const { return kind == column_kind::partition_key; }
|
||||
bool is_clustering_key() const { return kind == column_kind::clustering_key; }
|
||||
bool is_primary_key() const { return kind == column_kind::partition_key || kind == column_kind::clustering_key; }
|
||||
bool is_atomic() const { return type->is_atomic(); }
|
||||
bool is_atomic() const { return _is_atomic; }
|
||||
bool is_compact_value() const { return kind == column_kind::compact_column; }
|
||||
const sstring& name_as_text() const;
|
||||
const bytes& name() const;
|
||||
|
||||
Reference in New Issue
Block a user