Skip to content

Performance improvement in Decoder::decode_value#505

Merged
mpenick merged 5 commits intoapache:masterfrom
zakalibit:decode_row_perf_fix
Apr 6, 2021
Merged

Performance improvement in Decoder::decode_value#505
mpenick merged 5 commits intoapache:masterfrom
zakalibit:decode_row_perf_fix

Conversation

@zakalibit
Copy link
Copy Markdown
Contributor

Please consider this optimisation, it gives about 39% improvement in decode_value, this results in 2-3% improvement in our production backend, which is considerable taking in account the scale of our deployments.

decode_value 7.55%, on the right side Value::operator= & Value::~Value
Screenshot 2021-04-02 at 12 35 39

decode_value 4.67%
Screenshot 2021-04-02 at 12 49 19

@mpenick
Copy link
Copy Markdown
Contributor

mpenick commented Apr 5, 2021

Nice improvement! Thanks. Could you run make format so this will make it through CI?

@zakalibit
Copy link
Copy Markdown
Contributor Author

Nice improvement! Thanks. Could you run make format so this will make it through CI?

done

Comment thread src/user_type_field_iterator.cpp Outdated
current_ = next_++;
return decoder_.decode_value(current_->type, value_);
value_ = decoder_.decode_value(current_->type);
return !!value_.data_type();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about using the following for these checks?

return value.is_valid();

where is_valid() is defined as:

bool Value::is_valid() {
   return value_.data_type();
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, it is more intuitive, will do the change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@mpenick mpenick merged commit 9f8f72d into apache:master Apr 6, 2021
@zakalibit zakalibit deleted the decode_row_perf_fix branch May 2, 2023 17:47
fsaporito pushed a commit to cloudian/cpp-driver that referenced this pull request May 9, 2023
* - decode_row() performance improvement
* - reduce branching


Co-authored-by: Alex Revetchi <alex.revetchi@synchronoss.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants