最近抽空对EJS/Hogan/Jade/Handlebars等几个模板引擎做了些性能对比,下面发出对比结果。
先来说一下测试环境,
同一台机器,同样的环境,页面输出也就是最基础的Hello页面,模板功能中只使用了变量;
测试参数为ab -c 300 -t 10 http://127.0.0.1:5000/
========================= 割 =========================
下面4个结果都是在开发模式下的测试:
EJS:
This is ApacheBench, Version 2.3
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Server Software:
Server Hostname: 127.0.0.1
Server Port: 5000
Document Path: /
Document Length: 207 bytes
Concurrency Level: 300
Time taken for tests: 10.001 seconds
Complete requests: 5181
Failed requests: 0
Total transferred: 2015409 bytes
HTML transferred: 1072467 bytes
Requests per second: 518.04 [#/sec] (mean)
Time per request: 579.107 [ms] (mean)
Time per request: 1.930 [ms] (mean, across all concurrent requests)
Transfer rate: 196.79 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 232 832.7 0 7015
Processing: 171 303 65.0 279 704
Waiting: 168 303 65.0 279 704
Total: 188 536 846.8 285 7430
Percentage of the requests served within a certain time (ms)
50% 285
66% 359
75% 378
80% 389
90% 1249
95% 1452
98% 3369
99% 3476
100% 7430 (longest request)