Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save mbaumbach/e6e5114bb9220fdd37088608dab9e463 to your computer and use it in GitHub Desktop.

Select an option

Save mbaumbach/e6e5114bb9220fdd37088608dab9e463 to your computer and use it in GitHub Desktop.
import java.util.concurrent.TimeUnit;
import liqp.Template;
public class Playground {
private static void parse(String template) {
for (int i = 0; i < 10; i++) {
long start = System.nanoTime();
Template.parse(template);
System.out.println("Parse time (attempt: " + (i + 1) + "): " + TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start));
}
}
public static void main(String[] args) throws Exception {
String small = "Hello {{ name }}, how are you doing today? Hope this performs well!";
String medium = "";
for (int i = 0; i < 100; i++) {
medium += small + "\n";
}
String large = "";
for (int i = 0; i < 500; i++) {
large += small + "\n";
}
System.out.println("Parsing small");
parse(small);
System.out.println("Parsing medium");
parse(medium);
System.out.println("Parsing large");
parse(large);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment