diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-02 14:23:42 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-02 14:23:42 -0500 |
| commit | 350aed3fdb9f1e73e69655e53f44ca6a91c196da (patch) | |
| tree | 3d2a128667b5f6ca6d0b4e1f4865fc98aac6b60b /test/perf | |
| parent | 71f92436bdc86f30e2c21d8f5244733601e8c39e (diff) | |
| download | sqlalchemy-350aed3fdb9f1e73e69655e53f44ca6a91c196da.tar.gz | |
- whitespace removal bonanza
Diffstat (limited to 'test/perf')
| -rw-r--r-- | test/perf/README | 2 | ||||
| -rw-r--r-- | test/perf/objselectspeed.py | 4 | ||||
| -rw-r--r-- | test/perf/orm2010.py | 48 | ||||
| -rw-r--r-- | test/perf/sessions.py | 12 |
4 files changed, 33 insertions, 33 deletions
diff --git a/test/perf/README b/test/perf/README index dfb6df2cc..1d03cb5ce 100644 --- a/test/perf/README +++ b/test/perf/README @@ -14,4 +14,4 @@ Current automated stress and performance tests are in test/aaa_profiling/, which test either for expected function call count, or flat growth in memory usage over time. These tests are part of the automated test suite and are maintained for 100% success rate along Python versions from 2.4 through -current 3 versions.
\ No newline at end of file +current 3 versions.
\ No newline at end of file diff --git a/test/perf/objselectspeed.py b/test/perf/objselectspeed.py index 126c9c707..f64c73c69 100644 --- a/test/perf/objselectspeed.py +++ b/test/perf/objselectspeed.py @@ -38,14 +38,14 @@ def setup(): data = [{'name':'John Doe','sex':1,'age':35, 'type':'employee'}] * 100 for j in xrange(500): i.execute(data) - + # note we arent fetching from employee_table, # so we can leave it empty even though its "incorrect" #i = Employee_table.insert() #data = [{'foo':'foo', 'bar':'bar':'bat':'bat'}] * 100 #for j in xrange(500): # i.execute(data) - + print "Inserted 50,000 rows" def sqlite_select(entity_cls): diff --git a/test/perf/orm2010.py b/test/perf/orm2010.py index 46703b6da..d24376cc9 100644 --- a/test/perf/orm2010.py +++ b/test/perf/orm2010.py @@ -23,50 +23,50 @@ from sqlalchemy.ext.declarative import declarative_base import random import os from decimal import Decimal - + Base = declarative_base() class Employee(Base): __tablename__ = 'employee' - + id = Column(Integer, primary_key=True) name = Column(String(100), nullable=False) type = Column(String(50), nullable=False) - + __mapper_args__ = {'polymorphic_on':type} class Boss(Employee): __tablename__ = 'boss' - + id = Column(Integer, ForeignKey('employee.id'), primary_key=True) golf_average = Column(Numeric) - + __mapper_args__ = {'polymorphic_identity':'boss'} - + class Grunt(Employee): __tablename__ = 'grunt' - + id = Column(Integer, ForeignKey('employee.id'), primary_key=True) savings = Column(Numeric) - + employer_id = Column(Integer, ForeignKey('boss.id')) # Configure an 'employer' relationship, where Grunt references # Boss. This is a joined-table subclass to subclass relationship, # which is a less typical case. - + # In 0.7, "Boss.id" is the "id" column of "boss", as would be expected. if __version__ >= "0.7": employer = relationship("Boss", backref="employees", primaryjoin=Boss.id==employer_id) - - # Prior to 0.7, "Boss.id" is the "id" column of "employee". + + # Prior to 0.7, "Boss.id" is the "id" column of "employee". # Long story. So we hardwire the relationship against the "id" # column of Boss' table. elif __version__ >= "0.6": employer = relationship("Boss", backref="employees", primaryjoin=Boss.__table__.c.id==employer_id) - + # In 0.5, the many-to-one loader wouldn't recognize the above as a # simple "identity map" fetch. So to give 0.5 a chance to emit # the same amount of SQL as 0.6, we hardwire the relationship against @@ -75,9 +75,9 @@ class Grunt(Employee): employer = relationship("Boss", backref="employees", primaryjoin=Employee.__table__.c.id==employer_id, foreign_keys=employer_id) - + __mapper_args__ = {'polymorphic_identity':'grunt'} - + if os.path.exists('orm2010.db'): os.remove('orm2010.db') # use a file based database so that cursor.execute() has some @@ -99,9 +99,9 @@ def runit(): ] sess.add_all(bosses) - - - # create 10000 Grunt objects. + + + # create 10000 Grunt objects. grunts = [ Grunt( name="Grunt %d" % i, @@ -109,7 +109,7 @@ def runit(): ) for i in xrange(10000) ] - + # Assign each Grunt a Boss. Look them up in the DB # to simulate a little bit of two-way activity with the # DB while we populate. Autoflush occurs on each query. @@ -121,15 +121,15 @@ def runit(): first() for grunt in grunts[0:100]: grunt.employer = boss - + grunts = grunts[100:] sess.commit() report = [] - + # load all the Grunts, print a report with their name, stats, - # and their bosses' stats. + # and their bosses' stats. for grunt in sess.query(Grunt): # here, the overhead of a many-to-one fetch of # "grunt.employer" directly from the identity map @@ -160,7 +160,7 @@ print 'Total executemany calls: %d' \ "objects>", 0) os.system("runsnake %s" % filename) - + # SQLA Version: 0.7b1 # Total calls 4956750 # Total execute calls: 11201 @@ -178,9 +178,9 @@ os.system("runsnake %s" % filename) - - + + diff --git a/test/perf/sessions.py b/test/perf/sessions.py index 2fe4f758f..c1258e732 100644 --- a/test/perf/sessions.py +++ b/test/perf/sessions.py @@ -23,7 +23,7 @@ class SessionTest(TestBase, AssertsExecutionResults): Column('c2', String(30)), Column('t1id', Integer, ForeignKey('t1.c1')) ) - + metadata.create_all() l = [] @@ -35,7 +35,7 @@ class SessionTest(TestBase, AssertsExecutionResults): for y in range(1, 100): l.append({'c2':'this is t2 #%d' % y, 't1id':x}) t2.insert().execute(*l) - + class T1(_fixtures.Base): pass class T2(_fixtures.Base): @@ -45,12 +45,12 @@ class SessionTest(TestBase, AssertsExecutionResults): 't2s':relationship(T2, backref='t1') }) mapper(T2, t2) - + @classmethod def teardown_class(cls): metadata.drop_all() clear_mappers() - + @profiling.profiled('clean', report=True) def test_session_clean(self): for x in range(0, ITERATIONS): @@ -68,7 +68,7 @@ class SessionTest(TestBase, AssertsExecutionResults): for x in range(0, ITERATIONS): sess = create_session() t1s = sess.query(T1).filter(T1.c1.between(15, 48)).all() - + for index in [2, 7, 12, 15, 18, 20]: t1s[index].c2 = 'this is some modified text' for t2 in t1s[index].t2s: @@ -76,7 +76,7 @@ class SessionTest(TestBase, AssertsExecutionResults): del t1s gc_collect() - + sess.close() del sess gc_collect() |
