Open shibayu36 opened 7 years ago
I cannot run HTMLEscapeTest.java in examples/microbenchmarks/, because Benchmark interface using lambda is deprecated.
I wrote a test program which can execute.
package me.geso.microbenchmarks; import org.junit.Test; import me.geso.nanobench.Benchmark; import org.apache.commons.lang3.StringEscapeUtils; import org.springframework.web.util.HtmlUtils; import com.google.common.html.HtmlEscapers; public class HTMLEscapeTest { @Test public void testHTMLEscape() throws Exception { new Benchmark(new HTMLEscapeTestBenchmark()) .runByTime(1).timethese().cmpthese(); } public static class HTMLEscapeTestBenchmark { final String src = "<><><><>&&&&;;;;jl2kjlnnfljflksdjfuowu-9urjnl321knl;fu3poifuokbkvnl;uigufjslfjadsipuru1o2krn;lkmfzkjhvojopijkJ:LJKU)!*)($J!KLJOIFHS)JPJ"; public void benchGuava() { HtmlEscapers.htmlEscaper().escape(src); } public void benchCommons() { StringEscapeUtils.escapeHtml4(src); } public void benchStringReplace() { src.replace("&", "&").replace(">", ">") .replace("<", "<") .replace("'", "'") .replaceAll("\"", """); } public void benchSpring() { HtmlUtils.htmlEscape(src); } } }
I tried to send a pull request, but I don't understand how to run this program in maven project under gradle project. So just issued.
It looks good to me :)
I cannot run HTMLEscapeTest.java in examples/microbenchmarks/, because Benchmark interface using lambda is deprecated.
I wrote a test program which can execute.
I tried to send a pull request, but I don't understand how to run this program in maven project under gradle project. So just issued.