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

FixedSizeQueue: Work around GCC generating large amounts of debug info #8386

Merged
merged 1 commit into from Oct 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion Source/Core/Common/FixedSizeQueue.h
Expand Up @@ -21,7 +21,13 @@ class FixedSizeQueue
void clear()
{
if constexpr (!std::is_trivial_v<T>)
storage = {};
{
// The clear of non-trivial objects previously used "storage = {}". However, this causes GCC
// to take a very long time to compile the file/function, as well as generating huge amounts
// of debug information (~2GB object file, ~600MB of debug info).
while (count > 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
while (count > 0)
storage.fill({});

I played around with Compiler Explorer and this is semantically equivalent to initializing with an empty initializer list and produces sane code.

Copy link
Member

Choose a reason for hiding this comment

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

Using .fill would be nicer if it does work around the bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As I mentioned on IRC, filling would have the effect of always default constructing N (5000 in the log case) objects vs count objects. For the clear button this isn't a big deal but it might matter with other users of the class.

Copy link
Contributor

Choose a reason for hiding this comment

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

In this case I'm cool with it.

pop();
}

head = 0;
tail = 0;
Expand Down