如果想验证一个日志文件,是否匹配 error、ERROR、Error 中的任何一个?
到底是 3 次 contains 快,还是直接 "error|ERROR|Error" 更快?
实战测试
我们用一个长文本 8k 左右,循环 100W 次。
基本变量
public class PerConst {
public static final int times = 1000000;
public static final String log = "8K 长的文本";
}