performance - Why use a compile_pattern for binary:replace? -
is there documentation states why 1 should use compile_pattern/1
result pattern binary:replace/4
search for?
i suspect it's performance reasons can't find official states such.
i don't know of documentation explicitly states either, yes, it's performance reasons. if pass non-compiled pattern calls in binary
module, compile pattern , use it. means single use, compiling first doesn't matter since call compile anyway. if you're performing multiple matches or replacements using same pattern, makes sense compile once front , pass compiled pattern each of calls.
Comments
Post a Comment