Skip to content

Commit

Permalink
Added 'make newbench'.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgm committed Dec 6, 2016
1 parent 847b501 commit 5255e2d
Show file tree
Hide file tree
Showing 27 changed files with 458 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ SITE=_site
SPECVERSION=$(shell perl -ne 'print $$1 if /^version: *([0-9.]+)/' $(SPEC))
FUZZCHARS?=2000000 # for fuzztest
BENCHDIR=bench
BENCHSAMPLES=$(wildcard $(BENCHDIR)/samples/*.md)
BENCHFILE=$(BENCHDIR)/benchinput.md
ALLTESTS=alltests.md
NUMRUNS?=10
Expand All @@ -21,7 +22,7 @@ CLANG_CHECK?=clang-check
CLANG_FORMAT=clang-format -style llvm -sort-includes=0 -i
AFL_PATH?=/usr/local/bin

.PHONY: all cmake_build leakcheck clean fuzztest test debug ubsan asan mingw archive bench format update-spec afl clang-check
.PHONY: all cmake_build leakcheck clean fuzztest test debug ubsan asan mingw archive newbench bench format update-spec afl clang-check

all: cmake_build man/man3/cmark.3

Expand Down Expand Up @@ -166,6 +167,17 @@ bench: $(BENCHFILE)
done \
} 2>&1 | grep 'real' | awk '{print $$2}' | python3 'bench/stats.py'

newbench:
for f in $(BENCHSAMPLES) ; do \
printf "%26s " `basename $$f` ; \
{ for x in `seq 1 $(NUMRUNS)` ; do \
/usr/bin/env time -p $(PROG) </dev/null >/dev/null ; \
for x in `seq 1 200` ; do cat $$f ; done | \
/usr/bin/env time -p $(PROG) > /dev/null; \
done \
} 2>&1 | grep 'real' | awk '{print $$2}' | \
python3 'bench/stats.py'; done

format:
$(CLANG_FORMAT) src/*.c src/*.h api_test/*.c api_test/*.h

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ To run a benchmark:

make bench

For more detailed benchmarks:

make newbench

To run a test for memory leaks using `valgrind`:

make leakcheck
Expand Down
16 changes: 16 additions & 0 deletions bench/samples/block-bq-flat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
> the simple example of a blockquote
> the simple example of a blockquote
> the simple example of a blockquote
> the simple example of a blockquote
... continuation
... continuation
... continuation
... continuation

empty blockquote:

>
>
>
>
13 changes: 13 additions & 0 deletions bench/samples/block-bq-nested.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
>>>>>> deeply nested blockquote
>>>>> deeply nested blockquote
>>>> deeply nested blockquote
>>> deeply nested blockquote
>> deeply nested blockquote
> deeply nested blockquote
> deeply nested blockquote
>> deeply nested blockquote
>>> deeply nested blockquote
>>>> deeply nested blockquote
>>>>> deeply nested blockquote
>>>>>> deeply nested blockquote
11 changes: 11 additions & 0 deletions bench/samples/block-code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

an
example

of



a code
block

14 changes: 14 additions & 0 deletions bench/samples/block-fences.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

``````````text
an
example
```
of
a fenced
```
code
block
``````````

9 changes: 9 additions & 0 deletions bench/samples/block-heading.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# heading
### heading
##### heading

# heading #
### heading ###
##### heading \#\#\#\#\######

############ not a heading
10 changes: 10 additions & 0 deletions bench/samples/block-hr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

* * * * *

- - - - -

________


************************* text

32 changes: 32 additions & 0 deletions bench/samples/block-html.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<div class="this is an html block">

blah blah

</div>

<table>
<tr>
<td>
**test**
</td>
</tr>
</table>

<table>

<tr>

<td>

test

</td>

</tr>

</table>

<![CDATA[
[[[[[[[[[[[... *cdata section - this should not be parsed* ...]]]]]]]]]]]
]]>

8 changes: 8 additions & 0 deletions bench/samples/block-lheading.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
heading
---

heading
===================================

not a heading
----------------------------------- text
67 changes: 67 additions & 0 deletions bench/samples/block-list-flat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
- tidy
- bullet
- list


- loose

- bullet

- list


0. ordered
1. list
2. example


-
-
-
-


1.
2.
3.


- an example
of a list item
with a continuation

this part is inside the list

this part is just a paragraph


1. test
- test
1. test
- test


111111111111111111111111111111111111111111. is this a valid bullet?

- _________________________

- this
- is

a

long
- loose
- list

- with
- some

tidy

- list
- items
- in

- between
- _________________________
36 changes: 36 additions & 0 deletions bench/samples/block-list-nested.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

- this
- is
- a
- deeply
- nested
- bullet
- list


1. this
2. is
3. a
4. deeply
5. nested
6. unordered
7. list


- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 6
- 5
- 4
- 3
- 2
- 1


- - - - - - - - - deeply-nested one-element item

15 changes: 15 additions & 0 deletions bench/samples/block-ref-flat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[1] [2] [3] [1] [2] [3]

[looooooooooooooooooooooooooooooooooooooooooooooooooong label]

[1]: <http://something.example.com/foo/bar>
[2]: http://something.example.com/foo/bar 'test'
[3]:
http://foo/bar
[ looooooooooooooooooooooooooooooooooooooooooooooooooong label ]:
111
'test'
[[[[[[[[[[[[[[[[[[[[ this should not slow down anything ]]]]]]]]]]]]]]]]]]]]: q
(as long as it is not referenced anywhere)

[[[[[[[[[[[[[[[[[[[[]: this is not a valid reference
17 changes: 17 additions & 0 deletions bench/samples/block-ref-nested.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[[[[[[[foo]]]]]]]

[[[[[[[foo]]]]]]]: bar
[[[[[[foo]]]]]]: bar
[[[[[foo]]]]]: bar
[[[[foo]]]]: bar
[[[foo]]]: bar
[[foo]]: bar
[foo]: bar

[*[*[*[*[foo]*]*]*]*]

[*[*[*[*[foo]*]*]*]*]: bar
[*[*[*[foo]*]*]*]: bar
[*[*[foo]*]*]: bar
[*[foo]*]: bar
[foo]: bar
14 changes: 14 additions & 0 deletions bench/samples/inline-autolink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
closed (valid) autolinks:

<ftp://1.2.3.4:21/path/foo>
<http://foo.bar.baz?q=hello&id=22&boolean>
<http://veeeeeeeeeeeeeeeeeeery.loooooooooooooooooooooooooooooooong.autolink/>
<teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeest@gmail.com>

these are not autolinks:

<ftp://1.2.3.4:21/path/foo
<http://foo.bar.baz?q=hello&id=22&boolean
<http://veeeeeeeeeeeeeeeeeeery.loooooooooooooooooooooooooooooooong.autolink
<teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeest@gmail.com
< http://foo.bar.baz?q=hello&id=22&boolean >
3 changes: 3 additions & 0 deletions bench/samples/inline-backticks.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
`lots`of`backticks`

``i``wonder``how``this``will``be``parsed``
5 changes: 5 additions & 0 deletions bench/samples/inline-em-flat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*this* *is* *your* *basic* *boring* *emphasis*

_this_ _is_ _your_ _basic_ _boring_ _emphasis_

**this** **is** **your** **basic** **boring** **emphasis**
5 changes: 5 additions & 0 deletions bench/samples/inline-em-nested.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*this *is *a *bunch* of* nested* emphases*

__this __is __a __bunch__ of__ nested__ emphases__

***this ***is ***a ***bunch*** of*** nested*** emphases***
5 changes: 5 additions & 0 deletions bench/samples/inline-em-worst.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*this *is *a *worst *case *for *em *backtracking

__this __is __a __worst __case __for __em __backtracking

***this ***is ***a ***worst ***case ***for ***em ***backtracking
11 changes: 11 additions & 0 deletions bench/samples/inline-entity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
entities:

&nbsp; &amp; &copy; &AElig; &Dcaron; &frac34; &HilbertSpace; &DifferentialD; &ClockwiseContourIntegral;

&#35; &#1234; &#992; &#98765432;

non-entities:

&18900987654321234567890; &1234567890098765432123456789009876543212345678987654;

&qwertyuioppoiuytrewqwer; &oiuytrewqwertyuioiuytrewqwertyuioytrewqwertyuiiuytri;
15 changes: 15 additions & 0 deletions bench/samples/inline-escape.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

\t\e\s\t\i\n\g \e\s\c\a\p\e \s\e\q\u\e\n\c\e\s

\!\\\"\#\$\%\&\'\(\)\*\+\,\.\/\:\;\<\=\>\?

\@ \[ \] \^ \_ \` \{ \| \} \~ \- \'

\
\\
\\\
\\\\
\\\\\

\<this\> \<is\> \<not\> \<html\>

Loading

0 comments on commit 5255e2d

Please sign in to comment.