summaryrefslogtreecommitdiff
path: root/examples/performance
diff options
context:
space:
mode:
Diffstat (limited to 'examples/performance')
-rw-r--r--examples/performance/__init__.py2
-rw-r--r--examples/performance/short_selects.py6
2 files changed, 5 insertions, 3 deletions
diff --git a/examples/performance/__init__.py b/examples/performance/__init__.py
index 88ae9b7dc..6264ae9f7 100644
--- a/examples/performance/__init__.py
+++ b/examples/performance/__init__.py
@@ -6,7 +6,7 @@ profile and associated implications:
* bulk inserts
* individual inserts, with or without transactions
* fetching large numbers of rows
-* running lots of small queries (TODO)
+* running lots of short queries
All suites include a variety of use patterns illustrating both Core
and ORM use, and are generally sorted in order of performance from worst
diff --git a/examples/performance/short_selects.py b/examples/performance/short_selects.py
index 27120fe6a..ef1fcff4a 100644
--- a/examples/performance/short_selects.py
+++ b/examples/performance/short_selects.py
@@ -73,9 +73,10 @@ def test_orm_query_cols_only(n):
@Profiler.profile
def test_baked_query(n):
"""test a baked query of the full entity."""
+ bakery = baked.bakery()
s = Session(bind=engine)
for id_ in random.sample(ids, n):
- q = baked.BakedQuery(lambda s: s.query(Customer))
+ q = bakery(lambda s: s.query(Customer))
q += lambda q: q.filter(Customer.id == bindparam('id'))
q(s).params(id=id_).one()
@@ -83,9 +84,10 @@ def test_baked_query(n):
@Profiler.profile
def test_baked_query_cols_only(n):
"""test a baked query of only the entity columns."""
+ bakery = baked.bakery()
s = Session(bind=engine)
for id_ in random.sample(ids, n):
- q = baked.BakedQuery(
+ q = bakery(
lambda s: s.query(
Customer.id, Customer.name, Customer.description))
q += lambda q: q.filter(Customer.id == bindparam('id'))