Skip to content

Opts for portions of the code#13

Open
mdaiter wants to merge 2 commits into
PascalPons:masterfrom
mdaiter:opts
Open

Opts for portions of the code#13
mdaiter wants to merge 2 commits into
PascalPons:masterfrom
mdaiter:opts

Conversation

@mdaiter
Copy link
Copy Markdown

@mdaiter mdaiter commented May 2, 2019

Hey @PascalPons ,
Just had a few optimizations I'd like to commit. Most of these are minor that just caught my eye.
Thanks so much

Comment thread TranspositionTable.hpp
Comment thread Solver.hpp
Comment thread Solver.cpp
Comment thread Solver.hpp
Comment thread Position.hpp
Comment thread Position.hpp
Comment thread Position.hpp
Comment thread OpeningBook.hpp
Comment thread MoveSorter.hpp
return 0;
inline Position::position_t getNext() __attribute__((always_inline)) {
return size ? entries[--size].move : 0;
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I prefer avoiding non standard C++ code.

moreover any good C++ compiler will almost certainly inline this code without having to force it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

http://www.cplusplus.com/articles/1AUq5Di1/
^This is standard. However, I understand if you don't want to include this for readability.

Copy link
Copy Markdown
Author

@mdaiter mdaiter May 7, 2019

Choose a reason for hiding this comment

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

You could even further optimise this to avoid your jump statement:

size -= static_cast<int>(size > 0);
return (size > 0) * entries[size].move;

Comment thread MoveSorter.hpp
Comment thread Position.hpp
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