<commit_before>package com.mitchellbosecke.benchmark;

import java.io.StringWriter;
import java.io.Writer;
import java.util.Map;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Setup;

import com.github.mustachejava.DefaultMustacheFactory;
import com.github.mustachejava.Mustache;
import com.github.mustachejava.MustacheFactory;

public class MoustacheBenchmark extends BaseBenchmark {

    private Map<String, Object> context;

    private Mustache template;

    @Setup
    public void setup() {
        MustacheFactory mustacheFactory = new DefaultMustacheFactory();
        template = mustacheFactory.compile("templates/stocks.mustache.html");
        this.context = getContext();
    }

    @Benchmark
    public String benchmark() {
        Writer writer = new StringWriter();
        template.execute(writer, context);
        return writer.toString();
    }

}
<commit_msg>Turn off HTML escaping as per the benchmarking rules.<commit_after>package com.mitchellbosecke.benchmark;

import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Map;

import com.github.mustachejava.MustacheException;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Setup;

import com.github.mustachejava.DefaultMustacheFactory;
import com.github.mustachejava.Mustache;
import com.github.mustachejava.MustacheFactory;

public class MoustacheBenchmark extends BaseBenchmark {

    private Map<String, Object> context;

    private Mustache template;

    @Setup
    public void setup() {
        MustacheFactory mustacheFactory = new DefaultMustacheFactory() {
          @Override
          public void encode(String value, Writer writer) {
            // Disable HTML escaping
            try {
              writer.write(value);
            } catch (IOException e) {
              throw new MustacheException(e);
            }
          }
        };
        template = mustacheFactory.compile("templates/stocks.mustache.html");
        this.context = getContext();
    }

    @Benchmark
    public String benchmark() {
        Writer writer = new StringWriter();
        template.execute(writer, context);
        return writer.toString();
    }

}

{'fraction_non_alphanumeric': 0.090625, 'fraction_numerical': 0.0, 'mean_word_length': 3.204502814258912, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6000602', 'n_tokens_mistral': 634, 'n_tokens_neox': 616, 'n_words': 138}