And in the spirit of
http://blog.curiasolutions.com/2009/10/the-great-web-technology-shootout-round-3-better-faster-and-shinier/
a Chameleon hello world benchmark, rendering a template from a view that calls
repoze.bfg.chameleon_zpt.render_template_to_response filling a slot in a
macro from another template:
The view:
from repoze.bfg.chameleon_zpt import render_template_to_response
from repoze.bfg.chameleon_zpt import get_template
master = get_template('templates/master.pt')
def my_view(request):
return render_template_to_response('templates/mytemplate.pt',
project='starter', master=master)
The mytemplate.pt template:
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
xmlns:tal=http://xml.zope.org/namespaces/tal;
xmlns:metal=http://xml.zope.org/namespaces/metal;
body
span metal:use-macro=master.macros['main']
span metal:fill-slot=content
pLorem ipsum dolor sit amet, consecteteur adipiscing elit nisi
ultricies. Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem
penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin.
Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra
a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni
tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac.
Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue,
aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis.
Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui,
ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum
non./p
/span
/span
/body
/html
The master.pt template:
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;
html xmlns=http://www.w3.org/1999/xhtml;
xmlns:tal=http://xml.zope.org/namespaces/tal;
xmlns:metal=http://xml.zope.org/namespaces/metal;
body metal:define-macro=main
span metal:define-slot=content
Hello ${project}
/span
/body
/html
running ab -n1 -c10 against such a setup (as per the referenced blog entry):
Server Software:Apache/2.2.12
Server Hostname:127.0.0.1
Server Port:80
Document Path: /starter
Document Length:989 bytes
Concurrency Level: 10
Time taken for tests: 1.528 seconds
Complete requests: 1
Failed requests:0
Write errors: 0
Total transferred: 11801180 bytes
HTML transferred: 9890989 bytes
Requests per second:6544.78 [#/sec] (mean)
Time per request: 1.528 [ms] (mean)
Time per request: 0.153 [ms] (mean, across all concurrent requests)
Transfer rate: 7542.59 [Kbytes/sec] received
Siege results (1000 reps, 10 concurrent in benchmark mode) against same:
** SIEGE 2.68
** Preparing 10 concurrent users for battle.
The server is now under siege.. done.
Transactions: 1 hits
Availability: 100.00 %
Elapsed time:1.81 secs
Data transferred:5.69 MB
Response time: 0.00 secs
Transaction rate: 5524.86 trans/sec
Throughput: 3.15 MB/sec
Concurrency: 9.84
Successful transactions: 1
Failed transactions:0
Longest transaction: 0.01
Shortest transaction:0.00
Between 5500 - 6500 rps depending on whom you believe.
If you take for granted that the box described at
http://blog.curiasolutions.com/2009/10/the-great-web-technology-shootout-round-3-better-faster-and-shinier/
is roughly half as fast as this box that this test was performed on, and you
take for granted that those tests are roughly accurate: BFG beats everybody
else benchmarked by between 2X and 3X except for Bottle, which is slightly
faster in this test than BFG. Bottle beats BFG by 10% with Bottle+Mako vs
BFG+Chameleon, and by about 20% with no templating system involved.
- C
___
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev