AK: Accept StringView in LexicalPath::join

The first argument for LexicalPath::join was a String const&, which
resulted in an unnecessary memory copy when invoked with a StringView.
Changing the type of the parameter to StringView avoids the extra cost.

This was noticed while working on #10230.
This commit is contained in:
Rodrigo Tobar 2021-09-28 12:02:32 +08:00 committed by Idan Horowitz
parent 0af0ee4293
commit 69b64a6b04

View file

@ -36,7 +36,7 @@ public:
[[nodiscard]] static String relative_path(StringView const& absolute_path, StringView const& prefix);
template<typename... S>
[[nodiscard]] static LexicalPath join(String const& first, S&&... rest)
[[nodiscard]] static LexicalPath join(StringView first, S&&... rest)
{
StringBuilder builder;
builder.append(first);