Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

text::markdown::hoedownとそれ以外との比較ベンチマークがほしい。 #23

Closed
tokuhirom opened this issue Oct 6, 2013 · 6 comments

Comments

@tokuhirom
Copy link
Contributor

速度面でどのていどの差があるのかが知りたい。

@tokuhirom
Copy link
Contributor Author

具体的には Text::Markdown と Text::Markdown::Discount あたりの比較。
author/benchmark.pl あたりで p-r してくれる人がいるとありがたし。

@syohex
Copy link

syohex commented Oct 7, 2013

以下のようなもので良いでしょうか ?

#!/usr/bin/env perl
use strict;
use warnings;

use Text::Markdown;
use Text::Markdown::Discount;
use Text::Markdown::Hoedown;

use Benchmark qw(cmpthese);

my $markdown_text = <<'...';
[test]: http://google.com/ "Google"

# A heading

Just a note, I've found that I can't test my markdown parser vs others.
For example, both markdown.js and showdown code blocks in lists wrong. They're
also completely [inconsistent][test] with regards to paragraphs in list items.

A link. Not anymore.

<aside>This will make me fail the test because
markdown.js doesnt acknowledge arbitrary html blocks =/</aside>

* List Item 1

* List Item 2
  * New List Item 1
    Hi, this is a list item.
  * New List Item 2
    Another item
        Code goes here.
        Lots of it...
  * New List Item 3
    The last item

* List Item 3
The final item.

* List Item 4
The real final item.

Paragraph.
...

cmpthese(-5, {
    markdown => sub { Text::Markdown::markdown($markdown_text); },
    discount => sub { Text::Markdown::Discount::markdown($markdown_text); },
    hoedown  => sub { Text::Markdown::Hoedown::markdown($markdown_text); },
});

Result

            Rate markdown discount  hoedown
markdown   126/s       --     -99%     -99%
discount  9491/s    7446%       --     -62%
hoedown  24682/s   19523%     160%       --

@tokuhirom
Copy link
Contributor Author

えっ! hoedown こんなはやいのw

@tokuhirom
Copy link
Contributor Author

すごくよいとおもいますので p-r していただけると!

@syohex
Copy link

syohex commented Oct 7, 2013

差分を見ていて気づいたんですが, デフォルトでエスケープ処理をしてくれるのは
hoedownだけのようです.

@tokuhirom
Copy link
Contributor Author

というわけで close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants