Re: [PATCH] libstdc++: Optimize std::basic_string_view::starts_with

2024-06-03 Thread Jonathan Wakely
Pushed to trunk. On Sat, 1 Jun 2024 at 11:26, Jonathan Wakely wrote: > > We get smaller code at all optimization levels by not creating a > temporary object, just comparing lengths first and then using > traits_type::compare. This does less work than calling substr then > operator==. > > libstdc+

[PATCH] libstdc++: Optimize std::basic_string_view::starts_with

2024-06-01 Thread Jonathan Wakely
We get smaller code at all optimization levels by not creating a temporary object, just comparing lengths first and then using traits_type::compare. This does less work than calling substr then operator==. libstdc++-v3/ChangeLog: * include/std/string_view (starts_with(basic_string_view)):