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
kernel: speedup by using more pass-by-const-ref #1845
Conversation
Otherwise cell->setPort(ID::A, cell->getPort(ID::B)) could be invalid
char ch = 0; | ||
for (int j = 0; j < 8 && i + j < int (bits.size()); j++) | ||
if (bits[i + j] == RTLIL::State::S1) | ||
ch |= 1 << j; | ||
if (ch != 0) | ||
string_chars.push_back(ch); | ||
string.append({ch}); |
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.
So, doesn't this cause an unnecessary instantiation of an initializer_list<char>
? Is it not more efficient to do string.append(1, ch)
? Maybe I misunderstand something, because you're even careful enough to use emplace_back()
instead of push_back()
above.
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.
An initializer_list<char>
is a pair of pointers to stack; in principle, append(initializer_list<char>)
should cost the same as append(int, char)
.
Especially
SigSpec
andSigBit
.Also speedup wire deletion by directly modifying
Module
's private members.Retry of #1827...