Skip to content

perf: minor improvements in parse function#927

Merged
Disservin merged 4 commits intoDisservin:masterfrom
Adi-183:parse-function-improvements
Oct 4, 2025
Merged

perf: minor improvements in parse function#927
Disservin merged 4 commits intoDisservin:masterfrom
Adi-183:parse-function-improvements

Conversation

@Adi-183
Copy link
Copy Markdown
Contributor

@Adi-183 Adi-183 commented Oct 4, 2025

No description provided.


try {
std::vector<std::string> params;
params.reserve(2);
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.

For the -engine option we must specify at least two parameters (cmd and name). Without reserving, pushing these would trigger two allocations (size 0 → 1, then 1 → 2) because GCC’s std::vector typically doubles capacity on growth. Other options like -pgnout or -openings can have more parameters, so we might want to increase the reserved size accordingly.

@Disservin thoughts?

@Disservin
Copy link
Copy Markdown
Owner

this is really not performance important code, im happy to merge the map -> unordered change but dont think we need to start reserving memory right now

@Adi-183
Copy link
Copy Markdown
Contributor Author

Adi-183 commented Oct 4, 2025

Sure, @Disservin . I have reverted the reserve code. On a separate note, do you have any features/code improvements in mind? I am currently learning C++ and would love to make some more contributions.

@Disservin Disservin merged commit 091ad1b into Disservin:master Oct 4, 2025
18 checks passed
@Disservin
Copy link
Copy Markdown
Owner

potentially this #886 or #898, something more in depth and substantial would be #857

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