-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decoder: optimize decoding of optional and variant for scalar types #89
Decoder: optimize decoding of optional and variant for scalar types #89
Conversation
24e3d5e
to
7420d5f
Compare
e67b648
to
e123c94
Compare
.clang-format
Outdated
AlwaysBreakAfterReturnType: TopLevel | ||
ContinuationIndentWidth: 8 | ||
SpaceAfterTemplateKeyword: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this option.
In Dec.hpp
and Traits.hpp
, we have a space after template
.
Also, as I noticed, project's author @alyapunov always puts this space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropped this change, didn't notice it, sorry.
8121598
to
9438157
Compare
9438157
to
f8849de
Compare
@drewdzzz Interestingly, what the linter reports looks like a clang frontend bug, as if it assumes that the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, please address my comments.
What's about linter, let's ignore it.
TBH, it would be nice to remove it from CI of make it non-failing: #92.
@@ -7,5 +7,6 @@ UseTab: Always | |||
|
|||
AccessModifierOffset: -8 | |||
AlwaysBreakAfterReturnType: TopLevel | |||
ContinuationIndentWidth: 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is already in master.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rebased on master.
src/mpp/Dec.hpp
Outdated
@@ -1172,6 +1172,9 @@ bool jump_read_key(BUF& buf, T... t) | |||
return jump_find_key<PAIRS, FAMILY, PATH>(val, IS, buf, t...); | |||
} | |||
|
|||
template <compact::Family FAMILY, size_t SUBRULE, class DST, class BUF> | |||
constexpr bool is_object_readable_by_value_v = rule_by_family_t<FAMILY>::is_readable_by_value && std::is_assignable_v<DST, decltype(read_value<FAMILY, SUBRULE>(std::declval<BUF &>()))>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: it would be nice to move std::is_assignable_v
to the next line - this one is too large.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the ColumnLimit
option (120) to our .clang-format
.
The commit makes clang-format config more suitable to our codebase.
Currently, we always emplace an optional or variant in order to pass the value they contain forward, as a reference. This is required for complex nested types. However, if we are dealing with a scalar type, we can read its value into the optional or variant in-place. Closes tarantool#84
f8849de
to
3f65332
Compare
|
This patch optimizes the decoding of optional and variant values for scalar types.
Closes #84