Skip to content

Commit

Permalink
improved use of find (fmtlib#1560)
Browse files Browse the repository at this point in the history
* improved use of find

*begin is supposed to be different from '{' when this find is used, so we can avoid checking it.
  • Loading branch information
IkarusDeveloper authored and Thomas Bernard committed Mar 18, 2020
1 parent e07e2d8 commit 3f3257e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -2543,7 +2543,7 @@ FMT_CONSTEXPR void parse_format_string(basic_string_view<Char> format_str,
// Doing two passes with memchr (one for '{' and another for '}') is up to
// 2.5x faster than the naive one-pass implementation on big format strings.
const Char* p = begin;
if (*begin != '{' && !find<IS_CONSTEXPR>(begin, end, '{', p))
if (*begin != '{' && !find<IS_CONSTEXPR>(begin + 1, end, '{', p))
return write(begin, end);
write(begin, p);
++p;
Expand Down

0 comments on commit 3f3257e

Please sign in to comment.