Project

General

Profile

« Previous | Next » 

Revision 419d2fc1

Added by k0kubun (Takashi Kokubun) over 2 years ago

[ruby/erb] Optimize the no-escape case with strpbrk
(https://github.com/ruby/erb/pull/29)

Typically, strpbrk(3) is optimized pretty well with SIMD instructions.
Just using it makes this as fast as a SIMD-based implementation for the
no-escape case.

Not utilizing this for escaped cases because memory allocation would be
a more significant bottleneck for many strings anyway. Also, there'll be
some overhead in calling a C function (strpbrk) many times because we're
not using SIMD instructions directly. So using strpbrk all the time
might not necessarily be faster.