https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110383
Bug ID: 110383 Summary: Missed optimiztion: Default operator== with trivial struct can be replaced with bcmp Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: madhur4127 at gmail dot com Target Milestone: --- Godbolt: https://compiler-explorer.com/z/Gr8E5zfo5 Default operator== produces inefficient assembly where it checks for each data member therefore having a lot of branches. Clang produces better assembly with memcmp / bcmp. I know its hard to generalize performance claims but in the worst case having 8 branches (one for each member), is not more efficient than a bcmp.