From ea4bbbfcb7f4febc93739acbacf9104cd85bd214 Mon Sep 17 00:00:00 2001 From: James Fulop Date: Wed, 15 Apr 2020 21:12:33 -0700 Subject: [PATCH] shader read optimization (#2109) Currently `const char * str` gets converted to a StringView when its passed to `bx::strFindNl`, incurring a strlen. We have the data to calculate the strlen and fully construct the StringView. --- tools/shaderc/shaderc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/shaderc/shaderc.h b/tools/shaderc/shaderc.h index 4964f77eb..003ce8f08 100644 --- a/tools/shaderc/shaderc.h +++ b/tools/shaderc/shaderc.h @@ -87,7 +87,7 @@ namespace bgfx uint32_t pos = m_pos; const char* str = &m_str[pos]; - const char* nl = bx::strFindNl(str).getPtr(); + const char* nl = bx::strFindNl(bx::StringView(str, str + (m_size - pos))).getPtr(); pos += (uint32_t)(nl - str); const char* eol = &m_str[pos];