Skip to content
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

Build the command map at compile time (fix #3298) #4240

Closed
wants to merge 2 commits into from

Conversation

ckeshava
Copy link
Collaborator

If merged, this commit will:

  • Provide comparative analysis of Data Structures
  • time/profile performance of parseCommand function
  • declare commands array as constexpr

- time performance of parseCommand function
- declare commands array as constexpr
@ckeshava
Copy link
Collaborator Author

@scottschurr @nbougalis let me know if this looks okay.

Copy link
Contributor

@nbougalis nbougalis left a comment

Choose a reason for hiding this comment

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

Thank you for doing this, but I think that the inline comment is not necessary.

Instead, what I recommend, is that you change this commit to simply remove the FIXME comment and provide a description of the tests you performed in the commit (i.e. what you have as a comment) as part of the commit message.

Detailed description:

The below data structure (commands) is profiled with four alternatives -
- linear search on an array
- binary search on a sorted array
- using std::map data structure
- using std::unordered_map data structure.

Both linear search and std::unordered_map outperformed the other alternatives.
Hence, I don't think it warrants a change.
If the number of rpc-handler-commands increase in the future, then there might be a scope for improvement.
Detailed comparison - XRPLF#3298 (comment)
@ckeshava
Copy link
Collaborator Author

Okay, I have done the suggested changes 👍

This was referenced Aug 4, 2022
@intelliot intelliot changed the title Fix for issue 3298 Build the command map at compile time (fix #3298) Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants