Skip to content

Commit 30691c8

Browse files
committed
Revert the strpbrk optimization
because it's much slower on M1 #29. It'd be too complicated to switch the implementation based on known optimized platforms / versions. Besides, short strings are the most common usages of this method and SIMD doesn't really help that case. All in all, I can't justify the existence of this code.
1 parent 12058c3 commit 30691c8

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

ext/erb/erb.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ escaped_length(VALUE str)
3838
static VALUE
3939
optimized_escape_html(VALUE str)
4040
{
41-
// Use strpbrk to optimize the no-escape case when str is long enough for SIMD.
42-
if (RSTRING_LEN(str) >= 16 && strpbrk(RSTRING_PTR(str), "'&\"<>") == NULL) {
43-
return str;
44-
}
45-
4641
VALUE vbuf;
4742
char *buf = ALLOCV_N(char, vbuf, escaped_length(str));
4843
const char *cstr = RSTRING_PTR(str);

0 commit comments

Comments
 (0)