add @profiling.assert_method_count() decorator to test suite, set up some tests

Issue #753 resolved
Mike Bayer repo owner created an issue

Lets set up another profiling decorator that will dig into the hotshot stats to assert that the total function count of operations is within a given range (a max to ensure we havent added latency, a min to ensure that nothing weird is going on).

Then lets add some real tests to test/perf/ that run within the suite, and create tests for as many small operations as we can. Initial ideas are:

conn = pool.checkout()
conn.close()



conn = engine.connect()
conn.close()



s = table.select()
s.compile()



s = table.insert(values={'x':5})
s.compile()



engine.execute("select 1")

and then maybe some ORM things, like session.save(), session.flush(), attaching a child item to a parent where backrefs fire off, etc.

We can also add Robert's test suite in and adapt it to the new format.

Perhaps also, @profiling.assert_method_count() should also be sensitive to which dialect is in use. maybe @profiling.assert_method_count({'postgres':(50,100), 'sqlite':(30,50), 'default':(30,100)}) as an option.

Comments (4)

  1. jek

    Some way of tracking actual speed would also be very, very useful. (scaled CPU seconds?) Take 66428d908fb7b73886eec1c4920c7d8709bbca87, for example. This simple change in assignment style sped up the mass insert benchmark by 1.5%. 1.5% for an assignment!

    --- sqlalchemy/trunk/lib/sqlalchemy/sql/compiler.py 2007-08-21 07:55:43 UTC (rev 3383)
    +++ sqlalchemy/trunk/lib/sqlalchemy/sql/compiler.py 2007-08-21 08:19:21 UTC (rev 3384)
    @@ -223,10 +223,7 @@
    
             d = sql_util.ClauseParameters(self.dialect, self.positiontup)
    
    -        if self.parameters is None:
    -            pd = {}
    -        else:
    -            pd = self.parameters
    +        pd = self.parameters or {}
             if params is not None:
                 pd.update(params)
    
  2. Mike Bayer reporter

    nice "diff" embed :). Yeah, i think we can make improvements to this and also remove the "name" requirement from the decorator, but the basic idea is there now and a bunch of tests so im closing the ticket for now.

  3. Log in to comment