Last active
August 3, 2017 09:16
-
-
Save mity/24822b24d35ef1f998f970965f8c8e53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Generate samples to examine some basic features of the parser: | |
rm -rf samples | |
mkdir samples | |
touch samples/empty.md | |
#cp ~/prj/cmark/bench/benchinput.md samples/cmark-benchinput.md | |
#python3 -c 'print("\n" * 10*1000000)' > samples/many-blanks.md | |
python3 -c 'print("foo\n\n" * 1000000)' > samples/many-paragraphs.md | |
python3 -c 'print("###### foo\n" * 1000000)' > samples/many-atx-headers.md | |
#python3 -c 'print("~~~\nfoo\n~~~\n\n" * 1000000)' > samples/many-fenced-code-blocks.md | |
python3 -c 'print("foo " * 10*1000000)' > samples/long-block-oneline.md | |
#python3 -c 'print("foo\n" * 1000000)' > samples/long-block-multiline.md | |
#python3 -c 'print("*foo* " * 1000000)' > samples/many-emphasis.md | |
#python3 -c 'print("[a](/url) " * 1000000)' > samples/many-links.md | |
#python3 -c 'print("* foo\n" * 1000000)' > samples/long-list.md | |
#python3 -c 'print("* foo\n * a\n * b\n" * 1000000)' > samples/long-list-with-sublists.md | |
#python3 -c 'print("foo\n\n* foo\n\n" * 1000000)' > samples/many-lists.md | |
PROG_LIST="$HOME/prj/md4c/bin/md2html/md2html $HOME/prj/md4c+ast/bin-release/md2html+ast/md2html+ast $HOME/prj/cmark/build/src/cmark" | |
for prog in $PROG_LIST; do | |
printf "\n\n%s [performance]:\n" "$prog" | |
for sample in samples/*.md; do | |
# dry run to warm-up fs cache etc. | |
$prog $sample >/dev/null | |
printf "%s: " "$sample" | |
for i in `seq 10`; do | |
time -p $prog samples/empty.md | |
time -p $prog $sample >/dev/null | |
done 2>&1 | grep real | awk '{print $2}' | python3 ~/prj/cmark/bench/stats.py | |
done | |
done | |
for prog in $PROG_LIST; do | |
printf "\n\n%s [memory consumption]:\n" "$prog" | |
for sample in samples/*.md; do | |
printf "%s: " "$sample" | |
memusage $prog $sample 2>&1 >/dev/null | grep 'summary:' | sed 's/.*summary://' | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Results of MD4C's current master versus Cmark's current master: