org.joni.bench.AbstractBench Maven / Gradle / Ivy
The newest version!
package org.joni.bench;
import org.jcodings.specific.ASCIIEncoding;
import org.joni.Option;
import org.joni.Regex;
import org.joni.Syntax;
public abstract class AbstractBench {
protected void bench(String _reg, String _str, int warmup, int times) throws Exception {
byte[] reg = _reg.getBytes();
byte[] str = _str.getBytes();
Regex p = new Regex(reg,0,reg.length,Option.DEFAULT,ASCIIEncoding.INSTANCE,Syntax.DEFAULT);
System.err.println("::: /" + _reg + "/ =~ \"" + _str + "\", " + warmup + " * " + times + " times");
for(int j=0;j