zwoop commented on PR #9481:
URL: https://github.com/apache/trafficserver/pull/9481#issuecomment-1452072645

   Yeh, we've done this in the past as well, things just creeps up. I think 
longer term (intern maybe, good idea Craig) would be to make a very consistent 
layout of all structs and classes (in this order), one section for public and 
one section for private:
   
   1. All 64-bit types / pointers // (these will never be padded, so could go 
last as well
   2. All enum types // These can vary in size, I think, typically 2 bytes 
maybe ?
   3. All bitfields
   4. All bool types, or other 1 byte types
   5. All 32-bit types
   
   This won't solve all padding issues, but, it at least avoids a lot of them. 
Our HttpSM.h is particularly messy, I fixed some of it, but it was going back 
and forth between public / private. I fixed some of that, but not all.
   
   Additionally, it can help to arrange  the public vs private sections in a 
way that the padding between the two is minimized. This may require reordering 
the list above around those boundaries.
   
   I used a tool call pahole for this. It's definitely not great, because of 
our class structures and stuff, and doesn't do an awesome job with classes. 
Maybe there are better tools to investigate, or, maybe just use `-Wpadding` ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to