提交 929a6500 编写于 作者: X Xavier Noria

performance boost for String#blank? in Ruby 2.4

Some casual benchmarks showed a 2x factor.

All credit goes to @nurse.
上级 575dbeee
......@@ -115,7 +115,7 @@ def blank?
# The regexp that matches blank strings is expensive. For the case of empty
# strings we can speed up this method (~3.5x) with an empty? call. The
# penalty for the rest of strings is marginal.
empty? || BLANK_RE === self
empty? || BLANK_RE.match?(self)
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册