yeah, if I just put a print statement on line 282 of schema.py, which
your test in the first case says was called once (which makes no
sense at all), in the other says was called 94 times (more
reasonable), I get the identical number of print's for a given
program. I think the profiler is getting screwed up by the very deep
recursion (or whatever it is) introduced by the bug.
On Feb 24, 2006, at 8:53 AM, dmiller wrote:
On Feb 24, 2006, at 1:17 AM, Michael Bayer wrote:
yah well good luck with the profiling. this particular SA bug has
probably been there the entire time in the source tree.
Before (showing all calls in schema.py):
13023 function calls (11087 primitive calls) in 3.680 CPU
seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno
(function)
...
1 0.000 0.000 0.000 0.000 schema.py:1(?)
1 0.000 0.000 0.000 0.000 schema.py:104(__init__)
1 0.010 0.010 0.260 0.260 schema.py:16(?)
1 0.000 0.000 0.000 0.000 schema.py:214(Column)
2 0.000 0.000 0.000 0.000 schema.py:216(__init__)
1 0.000 0.000 0.000 0.000 schema.py:26(SchemaItem)
1 0.000 0.000 2.590 2.590 schema.py:28
(_init_items)
1 0.000 0.000 2.590 2.590 schema.py:282
(_set_parent)
1 0.000 0.000 0.000 0.000 schema.py:353
(ForeignKey)
1 0.000 0.000 0.000 0.000 schema.py:422
(DefaultGenerator)
1 0.000 0.000 0.000 0.000 schema.py:431
(PassiveDefault)
1 0.000 0.000 0.000 0.000 schema.py:440
(ColumnDefault)
1 0.000 0.000 0.000 0.000 schema.py:451(Sequence)
1 0.000 0.000 0.000 0.000 schema.py:468(Index)
986/1 2.590 0.003 2.590 2.590 schema.py:49
(__getattr__)
1 0.000 0.000 0.000 0.000 schema.py:515
(SchemaEngine)
1 0.000 0.000 0.000 0.000 schema.py:534
(SchemaVisitor)
1 0.000 0.000 0.000 0.000 schema.py:56
(_get_table_key)
1 0.000 0.000 0.000 0.000 schema.py:62
(__classinit__)
1 0.000 0.000 0.000 0.000 schema.py:64
(TableSingleton)
1 0.000 0.000 2.590 2.590 schema.py:66(__call__)
1 0.000 0.000 0.000 0.000 schema.py:7(Schema)
1 0.000 0.000 0.000 0.000 schema.py:98(Table)
...
After (showing all calls in schema.py):
29992 function calls (28782 primitive calls) in 2.190 CPU
seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno
(function)
...
1 0.000 0.000 0.010 0.010 schema.py:1(?)
18 0.010 0.001 0.010 0.001 schema.py:104(__init__)
1 0.010 0.010 0.220 0.220 schema.py:16(?)
18 0.000 0.000 0.000 0.000 schema.py:163(hash_key)
3 0.000 0.000 0.000 0.000 schema.py:187
(_from_python)
49 0.010 0.000 0.040 0.001 schema.py:188
(accept_visitor)
1 0.000 0.000 0.000 0.000 schema.py:214(Column)
134 0.000 0.000 0.000 0.000 schema.py:216(__init__)
1 0.000 0.000 0.000 0.000 schema.py:26(SchemaItem)
370 0.010 0.000 0.010 0.000 schema.py:261(<lambda>)
44 0.000 0.000 0.000 0.000 schema.py:262(<lambda>)
53 0.000 0.000 0.000 0.000 schema.py:263(<lambda>)
30 0.000 0.000 0.000 0.000 schema.py:263(add_field)
116/22 0.010 0.000 0.040 0.002 schema.py:28
(_init_items)
94 0.010 0.000 0.030 0.000 schema.py:282
(_set_parent)
40 0.000 0.000 0.020 0.000 schema.py:309
(_make_proxy)
585 0.000 0.000 0.010 0.000 schema.py:328
(accept_visitor)
29 0.000 0.000 0.000 0.000 schema.py:339(__eq__)
1 0.010 0.010 0.010 0.010 schema.py:353
(ForeignKey)
17 0.000 0.000 0.000 0.000 schema.py:356(__init__)
4 0.000 0.000 0.000 0.000 schema.py:367(copy)
4 0.000 0.000 0.000 0.000 schema.py:371
(_get_colspec)
38 0.000 0.000 0.030 0.001 schema.py:379
(references)
55 0.010 0.000 0.020 0.000 schema.py:383
(_init_column)
55 0.000 0.000 0.020 0.000 schema.py:407(<lambda>)
106 0.000 0.000 0.000 0.000 schema.py:409
(accept_visitor)
17 0.000 0.000 0.000 0.000 schema.py:413
(_set_parent)
1 0.000 0.000 0.000 0.000 schema.py:422
(DefaultGenerator)
11 0.000 0.000 0.000 0.000 schema.py:425
(_set_parent)
1 0.000 0.000 0.000 0.000 schema.py:431
(PassiveDefault)
1 0.000 0.000 0.000 0.000 schema.py:440
(ColumnDefault)
1 0.000 0.000 0.000 0.000 schema.py:451(Sequence)
11 0.000 0.000 0.000 0.000 schema.py:453(__init__)
127 0.000 0.000 0.000 0.000 schema.py:464
(accept_visitor)
1 0.000 0.000 0.000 0.000 schema.py:468(Index)
809 0.030 0.000 0.030 0.000 schema.py:49
(__getattr__)
1 0.000 0.000 0.000 0.000 schema.py:515
(SchemaEngine)
1 0.000 0.000 0.000 0.000 schema.py:534
(SchemaVisitor)
33 0.000 0.000 0.000 0.000 schema.py:539
(visit_table)
525 0.000 0.000 0.000 0.000 schema.py:542
(visit_column)
106 0.000 0.000 0.000 0.000 schema.py:545
(visit_foreign_key)
127 0.000 0.000 0.000 0.000 schema.py:557
(visit_sequence)
31 0.010 0.000 0.010 0.000 schema.py:56
(_get_table_key)
4 0.010 0.003 0.020 0.005 schema.py:62
(__classinit__)
1 0.000 0.000 0.000 0.000 schema.py:64
(TableSingleton)
31 0.000 0.000 0.060 0.002 schema.py:66(__call__)
1 0.000 0.000 0.000 0.000 schema.py:7(Schema)
3 0.000 0.000 0.000 0.000 schema.py:86
(__initargs__)
1 0.000 0.000 0.000 0.000 schema.py:98(Table)
...
Strange... that definitely made a difference though:
Before
986/1 2.590 0.003 2.590 2.590 schema.py:49
(__getattr__)
After
809 0.030 0.000 0.030 0.000 schema.py:49
(__getattr__)
The updated version has almost twice as many function calls but is
more than a second faster over all... Which makes me wonder, are
all those extra function calls needed? It seemed to be working fine
without them.
Also, now it seems to load faster (when I'm not profiling of course).
~ Daniel
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the
live webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?
cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users