|
|
|
|
|
by btdmaster
136 days ago
|
|
In my experience C++ abstractions give the optimizer a harder job and thus it generates worse code. In this case, different code is emitted by clang if you write a C version[0] versus C++ original[1]. Usually abstraction like this means that the compiler has to emit generic code which is then harder to flow through constraints and emit the same final assembly since it's less similar to the "canonical" version of the code that wouldn't use a magic `==` (in this case) or std::vector methods or something else like that. [0] https://godbolt.org/z/vso7xbh61 [1] https://godbolt.org/z/MjcEKd9Tr |
|