kzykhys/markbench

Markdown 基准框架

v0.1.3 2014-02-15 06:21 UTC

This package is not auto-updated.

Last update: 2024-09-14 15:11:18 UTC


README

Build Status Latest Stable Version SensioLabsInsight

所有解析器均由 composer 管理(最小稳定性=稳定)。使用最新稳定版进行测试。

在 Travis-CI 上查看最新基准

$ php bin/markbench benchmark --profile=github-sample
Runtime: PHP5.5.9
Host:    Linux testing-worker-linux-9-1-25355-linux-14-19501860 2.6.32-042stab079.5 #1 SMP Fri Aug 2 17:16:15 MSK 2013 x86_64
Profile: Sample content from Github (http://github.github.com/github-flavored-markdown/sample_content.html) / 1000 times
Class:   Markbench\Profile\GithubSampleProfile

+----------------------+---------+---------+---------------+----------+--------------+
| package              | version | dialect | duration (MS) | MEM (B)  | PEAK MEM (B) |
+----------------------+---------+---------+---------------+----------+--------------+
| erusev/parsedown     | 0.9.4   |         | 4183          | 9437184  | 9437184      |
| cebe/markdown        | 0.9.2   |         | 5081          | 9437184  | 9699328      |
| cebe/markdown        | 0.9.2   | gfm     | 6293          | 9437184  | 9699328      |
| michelf/php-markdown | 1.4.0   |         | 15568         | 9699328  | 9699328      |
| michelf/php-markdown | 1.4.0   | extra   | 23401         | 9699328  | 9961472      |
| kzykhys/ciconia      | v1.0.3  |         | 32115         | 10747904 | 11010048     |
| kzykhys/ciconia      | v1.0.3  | gfm     | 39654         | 10747904 | 11010048     |
+----------------------+---------+---------+---------------+----------+--------------+

测试过的解析器

内部

每个解析器都使用 kzykhys/Parallel.php 异步执行

Runner
 +-->(kzykhys/Parallel.php)
        +-- child process #1 --+
        +-- child process #2 --+--> output
        +-- child process #3 --+
        |-- duration/mem usage --|

要求

  • PHP5.4+
  • 编译时启用 --enable-pcntl

添加解析器

  • 将实现 Markbench\DriverInterface 的类放入 Driver 目录。
  • 再次运行命令

请随意分支并发送 pull request!

运行基准测试

composer install
bin/markbench benchmark
$ bin/markbench help benchmark
Usage:
 benchmark [--parser="..."] [-p|--profile[="..."]]

Options:
 --parser              Name of a parser. Available: cebe/markdown, cebe/markdown:gfm, kzykhys/ciconia, kzykhys/ciconia:gfm, erusev/parsedown, michelf/php-markdown, michelf/php-markdown:extra
 --profile (-p)        Name of a profile. (default: "default")
 --help (-h)           Display this help message.
 --quiet (-q)          Do not output any message.
 --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 --version (-V)        Display this application version.
 --ansi                Force ANSI output.
 --no-ansi             Disable ANSI output.
 --no-interaction (-n) Do not ask any interactive question.

配置文件

  • default
  • blank
  • github-sample

添加配置文件

  • 将实现 Markbench\ProfileInterface 的类放入 Profile 目录。
  • 运行 php bin/markbench benchmark --profile=your_profile_name

请随意分支并发送 pull request!

许可证

MIT 许可证

作者

Kazuyuki Hayashi (@kzykhys)