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

kernel: speedup by using more pass-by-const-ref #1845

Merged
merged 11 commits into from Apr 2, 2020
Merged

Conversation

eddiehung
Copy link
Collaborator

Especially SigSpec and SigBit.

Also speedup wire deletion by directly modifying Module's private members.

Retry of #1827...

kernel/rtlil.cc Show resolved Hide resolved
kernel/rtlil.cc Show resolved Hide resolved
@eddiehung eddiehung merged commit 37f42fe into master Apr 2, 2020
@eddiehung eddiehung deleted the eddie/kernel_speedup branch April 2, 2020 14:13
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});
Copy link
Contributor

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.

Copy link
Member

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).

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.

None yet

3 participants