Might be worth using values/copies even a bit bigger, so long as it's "simple" data. This[1] short post argues for passing `std::string_view` (~2 pointers) by value, for
- Omitting pointer indirections (loads),
- Not forcing the pointee to have an address (i.e. gotta be in memory, not just registers), and
- Eliminating aliasing questions, potentially leading to better codegen if the function isn't inlined.
- Omitting pointer indirections (loads),
- Not forcing the pointee to have an address (i.e. gotta be in memory, not just registers), and
- Eliminating aliasing questions, potentially leading to better codegen if the function isn't inlined.
1: https://quuxplusone.github.io/blog/2021/11/09/pass-string-vi...