gcc warning: ISO C++ forbids zero-size array ‘payload’ [-Wpedantic] clang warning: flexible array members are a C99 feature [-Wc99-extensions] is this still the case?
Outsmarting the compiler: Short story about optimization
21–26 of 26 posts
Re: Outsmarting the compiler: Short story about optimization
#22gcc warning: ISO C++ forbids zero-size array ‘payload’ [-Wpedantic] clang warning: flexible array members are a C99 feature [-Wc99-extensions] is this still the case?
Re: Outsmarting the compiler: Short story about optimization
#23Re: Outsmarting the compiler: Short story about optimization
#24> Then, a bit later, we need to very quickly finish populating the structs. I am finding it extremely hard to envision a circumstance where this is a bottleneck for anything. Care to clarify the context? I also find the struct layout really odd; why not just move c? Your benchmarks are also probably broken; branch predictors use global state so will almost certainly predict fine the way you've used things. You need t…
I'll give that benchmark trick a try. Thanks for the feedback. For some additional context, these structs are packed wire-line protocol structs. In reality the padding bytes are full of other fun details.
Re: Outsmarting the compiler: Short story about optimization
#25Earlier quoted context omitted.
I'll give that benchmark trick a try. Thanks for the feedback. For some additional context, these structs are packed wire-line protocol structs. In reality the padding bytes are full of other fun details.
The question for context is how this became something you want to optimise. It seems almost anything else you do with the values would cost more than the part you tried to optimise.
But, you are right that it probably doesn't matter. The minimal benchmarking I did convinced us that there wouldn't be much of a cost. The code that actually ended up being committed to our project has the branch.