benches/markdown: introduces engine markdown4j
authorAlexandre Terrasa <alexandre@moz-code.org>
Mon, 26 Jan 2015 17:50:17 +0000 (18:50 +0100)
committerAlexandre Terrasa <alexandre@moz-code.org>
Mon, 26 Jan 2015 17:50:20 +0000 (18:50 +0100)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

benchmarks/markdown/bench_markdown.sh
benchmarks/markdown/engines/Makefile
benchmarks/markdown/engines/markdown4j/Makefile [new file with mode: 0644]
benchmarks/markdown/engines/markdown4j/Markdown4j.java [new file with mode: 0644]

index c95ce55..4cb0f15 100755 (executable)
@@ -100,6 +100,18 @@ function bench_txtmark()
 }
 bench_txtmark
 
+function bench_markdown4j()
+{
+       name="$FUNCNAME"
+       skip_test "$name" && return
+       prepare_res $outdir/markdown4j.dat "markdown4j" "markdown4j"
+       for file in $bncdir/*.md; do
+               name=`basename $file .md`
+               bench_command "$bench" "" "java" "-cp" "$engdir/markdown4j/.:$engdir/markdown4j/markdown4j-2.2.jar" "Markdown4j" "$file" "$s"
+       done
+}
+bench_markdown4j
+
 if test "$#" -gt 0; then
     plot $outdir/bench_markdown.gnu
 fi
index a3932f8..588e744 100644 (file)
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-all: nitmd/nitmd txtmark/Txtmark.class
+all: nitmd/nitmd txtmark/Txtmark.class markdown4j/Markdown4j.class
 
 nitmd/nitmd:
        make -C nitmd
@@ -22,6 +22,10 @@ nitmd/nitmd:
 txtmark/Txtmark.class:
        make -C txtmark
 
+markdown4j/Markdown4j.class:
+       make -C markdown4j
+
 clean:
        make -C nitmd clean
        make -C txtmark clean
+       make -C markdown4j clean
diff --git a/benchmarks/markdown/engines/markdown4j/Makefile b/benchmarks/markdown/engines/markdown4j/Makefile
new file mode 100644 (file)
index 0000000..eff078b
--- /dev/null
@@ -0,0 +1,28 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Copyright 2015 Alexandre Terrasa <alexandre@moz-code.org>
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+Markdown4j.class: markdown4j-2.2.jar
+       javac -cp markdown4j-2.2.jar Markdown4j.java
+
+markdown4j-2.2.jar:
+       wget https://markdown4j.googlecode.com/files/markdown4j-2.2.jar
+
+test: Markdown4j.class
+       java -cp .:markdown4j-2.2.jar Markdown4j ../../benches/hello.md 5
+
+clean:
+       rm -rf markdown4j-2.2.jar
+       rm -rf Markdown4j.class
diff --git a/benchmarks/markdown/engines/markdown4j/Markdown4j.java b/benchmarks/markdown/engines/markdown4j/Markdown4j.java
new file mode 100644 (file)
index 0000000..547b9ac
--- /dev/null
@@ -0,0 +1,12 @@
+import com.github.rjeschke.txtmark.Processor;
+import java.io.File;
+import java.io.IOException;
+
+public class Markdown4j {
+       public static void main(String[] args) throws IOException {
+               int n = Integer.parseInt(args[1]);
+               for(int i = 0; i < n; i++) {
+                       System.out.println(Processor.process(new File(args[0])));
+               }
+       }
+}