another one with totally identical setup
web2py:
model:
-------
db=SQLDB('sqlite://storage.db')
db.define_table('page',
SQLField('title'),
SQLField('body','text'))
-------
controller
-------
def index():
mypages=db().select
(
db.page.id,db.page.title,orderby=db.page.title)
return dict(pages=mypages)
-------
view
-------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"
http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title>QuickWiki 6</title>
</head>
<body>
<div class="content">
{{include}}
</div>
</body>
</html>
-------
{{extend 'layout.html'}}
<h1 class="main">Title List</h1>
<ul id="titles">
{{for page in pages:}}
<li>
<span>{{=page.title}}</span>
[{{=A("visit",_href=URL(r=request,f='show',args=[
page.id]))}}]
</li>
{{pass}}
</ul>
pylons:
model:
-----
import quickwiki.lib.helpers as h
from pylons import config
from sqlalchemy import Column, MetaData, Table, types
from sqlalchemy.orm import mapper
from sqlalchemy.orm import scoped_session, sessionmaker
Session = scoped_session(sessionmaker(autoflush=True,
transactional=True,
bind=config
['pylons.g'].sa_engine))
metadata = MetaData()
pages_table = Table('pages', metadata,
Column('title', types.Unicode(40), primary_key=True),
Column('content', types.Unicode(), default='')
)
class Page(object):
content = None
def __str__(self):
return self.title
mapper(Page, pages_table)
-------
controller
-------
from quickwiki.model import Page
from quickwiki.lib.base import *
def list(self):
c.titles = [page.title for page in Session.query(Page).all()]
return render('/list.mako')
--------
template
--------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"
http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title>QuickWiki 6</title>
</head>
<body>
<div class="content">
${next.body()}
</div>
</body>
</html>
----------------
<%inherit file="base.mako"/>
<h1 class="main">Title List</h1>
<ul id="titles">
% for title in c.titles:
<li>
<span>${title}</span>
[${h.link_to('visit', h.url_for(title=title, action="index"))}]
</li>
% endfor
</ul>
-----------------
benchmark
web2py:
Server Software: Apache/2.2.3
Server Hostname: 10.8.8.18
Server Port: 80
Document Path: /welcometest/wiki
Document Length: 895 bytes
Concurrency Level: 1
Time taken for tests: 4.428 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 129000 bytes
HTML transferred: 89500 bytes
Requests per second: 22.58 [#/sec] (mean)
Time per request: 44.278 [ms] (mean)
Time per request: 44.278 [ms] (mean, across all concurrent
requests)
Transfer rate: 28.45 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 1.8 0 18
Processing: 38 44 6.1 42 72
Waiting: 38 44 6.0 41 70
Total: 39 44 6.4 42 72
Percentage of the requests served within a certain time (ms)
50% 42
66% 43
75% 44
80% 48
90% 54
95% 57
98% 66
99% 72
100% 72 (longest request)
pylons:
Server Software: Apache/2.2.3
Server Hostname: 10.8.8.17
Server Port: 80
Document Path: /wiki/page/list
Document Length: 895 bytes
Concurrency Level: 1
Time taken for tests: 5.191 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 109219 bytes
HTML transferred: 89500 bytes
Requests per second: 19.27 [#/sec] (mean)
Time per request: 51.906 [ms] (mean)
Time per request: 51.906 [ms] (mean, across all concurrent
requests)
Transfer rate: 20.55 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 1.8 0 19
Processing: 47 51 3.1 51 64
Waiting: 47 51 3.1 51 64
Total: 47 52 3.6 51 70
Percentage of the requests served within a certain time (ms)
50% 51
66% 52
75% 54
80% 54
90% 57
95% 58
98% 64
99% 70
100% 70 (longest request)