-
Notifications
You must be signed in to change notification settings - Fork 5
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
Inline index_offset_buffer_t methods #1439
Conversation
@@ -133,3 +133,29 @@ typename T_structure::iterator index_t<T_structure, T_iterator>::find_physical_k | |||
|
|||
return m_data.end(); | |||
} | |||
|
|||
gaia_offset_t index_offset_buffer_t::get_offset(size_t index) const |
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.
Can you put these in the order in which they are listed in the header, or change that order to match this one? The latter is probably even better, because methods like insert should precede simple getters like the other methods.
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.
done
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.
Just a minor request to list the methods in the same order during definition as during declaration.
production/db/inc/index/index.hpp
Outdated
inline void insert(gaia_offset_t offset, common::gaia_type_t type); | ||
inline gaia_offset_t get_offset(size_t index) const; | ||
inline common::gaia_type_t get_type(size_t index) const; | ||
inline bool empty() const; | ||
inline size_t size() const; |
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.
From my understanding, the inline
keyword has almost no effect on the compiler's decision on whether to inline or not. The semantic of the keyword has drastically changed from "you should inline this method" to "allow multiple definitions of the function".
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.
Indeed in the int_type_t
change the inline keyword hasn;t been specified.
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.
You have to specify inline
somewhere or you'll violate the ODR.
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
There were a number of trivial
index_offset_buffer_t
methods that showed up in profiles of the server, which turned out to be defined in a .cpp file, preventing inlining. Here is the most expensive one (about twice the overhead ofgaia::db::server_t::sort_log
):Measurements using
test_insert_perf.simple_table_insert
do not show a clear improvement, but profiling confirms that server overhead is reduced.