@@ -0,0 +1,3385 @@
+package edu.hm.hafner.analysis.parser;%0A%0Aimport java.net.URISyntaxException;%0Aimport java.nio.file.Paths;%0Aimport java.util.Objects;%0A%0Aimport org.openjdk.jmh.annotations.Benchmark;%0Aimport org.openjdk.jmh.annotations.BenchmarkMode;%0Aimport org.openjdk.jmh.annotations.Fork;%0Aimport org.openjdk.jmh.annotations.Level;%0Aimport org.openjdk.jmh.annotations.Mode;%0Aimport org.openjdk.jmh.annotations.Scope;%0Aimport org.openjdk.jmh.annotations.Setup;%0Aimport org.openjdk.jmh.annotations.State;%0Aimport org.openjdk.jmh.infra.Blackhole;%0A%0Aimport edu.hm.hafner.analysis.AbstractBenchmark;%0Aimport edu.hm.hafner.analysis.FileReaderFactory;%0Aimport edu.hm.hafner.analysis.ReaderFactory;%0Aimport edu.hm.hafner.analysis.Report;%0Aimport edu.hm.hafner.analysis.parser.checkstyle.CheckStyleParser;%0Aimport edu.hm.hafner.analysis.parser.pmd.PmdParser;%0A%0A/**%0A * Performance benchmarks for analysis parsers parsing xml files.%0A *%0A * @author Kevin Richter%0A * @author Simon Sch%C3%B6nwiese%0A */%0Apublic class ParserBenchmark extends AbstractBenchmark %7B%0A    /**%0A     * Benchmarking for parsing an xml file with a %7B@link CheckStyleParser%7D.%0A     *%0A     * @param state%0A     *         a %7B@link BenchmarkState%7D object containing the FileReaderFactory object%0A     * @param blackhole%0A     *         a %7B@link Blackhole%7D to avoid dead code elminination%0A     */%0A    @Benchmark%0A    @BenchmarkMode(Mode.AverageTime)%0A    @Fork(value = 1, warmups = 1)%0A    public void benchmarkCheckStyleParser(final BenchmarkState state, final Blackhole blackhole) %7B%0A        Report report = new CheckStyleParser().parse(state.getCheckstyleFileReaderFactory());%0A%0A        blackhole.consume(report);%0A    %7D%0A%0A    /**%0A     * Benchmarking for parsing an xml file with a %7B@link PmdParser%7D.%0A     *%0A     * @param state%0A     *         a %7B@link BenchmarkState%7D object containing the FileReaderFactory object%0A     * @param blackhole%0A     *         a %7B@link Blackhole%7D to avoid dead code elminination%0A     */%0A    @Benchmark%0A    @BenchmarkMode(Mode.AverageTime)%0A    @Fork(value = 1, warmups = 1)%0A    public void benchmarkPmdParser(final BenchmarkState state, final Blackhole blackhole) %7B%0A        Report report = new PmdParser().parse(state.getPmdFileReaderFactory());%0A%0A        blackhole.consume(report);%0A    %7D%0A%0A    /**%0A     * State for the benchmark containing all preconfigured and necessary objects.%0A     */%0A    @State(Scope.Benchmark)%0A    public static class BenchmarkState %7B%0A        private ReaderFactory checkstyleFileReaderFactory;%0A        private ReaderFactory pmdFileReaderFactory;%0A%0A        private ReaderFactory createFileReaderFactory(final String fileName) throws URISyntaxException %7B%0A            return new FileReaderFactory(%0A                    Paths.get(Objects.requireNonNull(BenchmarkState.class.getResource(fileName)).toURI()));%0A        %7D%0A%0A        public ReaderFactory getCheckstyleFileReaderFactory() %7B%0A            return checkstyleFileReaderFactory;%0A        %7D%0A%0A        public ReaderFactory getPmdFileReaderFactory() %7B%0A            return pmdFileReaderFactory;%0A        %7D%0A%0A        /**%0A         * Initializes history and FileReaderFactory object for the benchmarks.%0A         */%0A        @Setup(Level.Iteration)%0A        public void doSetup() throws URISyntaxException %7B%0A            checkstyleFileReaderFactory = createFileReaderFactory(%22checkstyle/issue19122.xml%22);%0A            pmdFileReaderFactory = createFileReaderFactory(%22pmd/issue54736.xml%22);%0A        %7D%0A    %7D%0A%7D%0A

Add benchmark for parsers.