~divmod-dev/divmod.org/trunk

« back to all changes in this revision

Viewing changes to Axiom/axiom/benchmarks/benchmark_itemcreation.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 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
 
    def txn():
19
 
        for x in range(10000):
20
 
            AB(a=x, b=unicode(x), store=s)
21
 
 
22
 
    benchmark.start()
23
 
    s.transact(txn)
24
 
    benchmark.stop()
25
 
 
26
 
 
27
 
if __name__ == '__main__':
28
 
    main()