And in the spirit of 
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/')

   def my_view(request):
       return render_template_to_response('templates/',
                                           project='starter', master=master)

The template:

   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
   <html xmlns="";
   <span metal:use-macro="master.macros['main']">
      <span metal:fill-slot="content">
       <p>Lorem 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 

The template:

   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   <html xmlns="";
   <body metal:define-macro="main">
     <span metal:define-slot="content">
       Hello ${project}

running ab -n10000 -c10 against such a setup (as per the referenced blog entry):

   Server Software:        Apache/2.2.12
   Server Hostname:
   Server Port:            80

   Document Path:          /starter
   Document Length:        989 bytes

   Concurrency Level:      10
   Time taken for tests:   1.528 seconds
   Complete requests:      10000
   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:                       10000 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:       10000
   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 
  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

Reply via email to