~divmod-dev/divmod.org/trunk

« back to all changes in this revision

Viewing changes to Axiom/axiom/benchmarks/benchmark_batchitemdeletion.py

  • Committer: Jean-Paul Calderone
  • Date: 2014-06-30 11:49:20 UTC
  • mfrom: (2750.1.1 remove-axiom-1325288)
  • Revision ID: exarkun@twistedmatrix.com-20140630114920-vgz02vv4ymbxkhnc
mergeĀ lp:~exarkun/divmod.org/remove-axiom-1325288

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
"""
3
 
Benchmark batch creation of a large number of simple Items in a transaction.
4
 
"""
5
 
 
6
 
from epsilon.scripts import benchmark
7
 
 
8
 
from axiom.store import Store
9
 
from axiom.item import Item
10
 
from axiom.attributes import integer, text
11
 
 
12
 
class AB(Item):
13
 
    a = integer()
14
 
    b = text()
15
 
 
16
 
def main():
17
 
    s = Store("TEMPORARY.axiom")
18
 
    rows = [(x, unicode(x)) for x in xrange(10000)]
19
 
    s.transact(lambda: s.batchInsert(AB, (AB.a, AB.b), rows))
20
 
 
21
 
    benchmark.start()
22
 
    s.transact(s.query(AB).deleteFromStore)
23
 
    benchmark.stop()
24
 
 
25
 
 
26
 
if __name__ == '__main__':
27
 
    main()