performance-wise - do u have any test/target for profiling? else i can
repeat some tests i did somewhen in february (if i remember them..)
=========
while looking to replace all {} with dict/Dict(), i found some things.
Here the list, quite random, probably some can be just ignored if not
an actual issue - i may have misunderstood things; have a look.
(btw The overall candidates for the replacement are like 60-70 lines,
all else are kwargs or lookup-tables.)
-------
database/informix.py:
ischema_names = { ... } has duplicate keys/entries
-------
database/*
get_col_spec(self) etc:
these string-formats may be better without the artificial dict,
eg. return self._extend("CHAR(%(length)s)" % {'length': self.length})
-> return self._extend("CHAR(%s)" % self.length )
or
-> return self._extend("CHAR(%(length)s)" % self.__dict__ )
no idea if get_col_spec() is used that much to have crucial impact on
speed though, at least it looks simpler.
-------
orm.util.AliasedClauses._create_row_adapter()
class AliasedRowAdapter( object):
1. can't this be made as standalone class, returning an instance,
initialized with the map, which is then __call__()ed ?
2. this can be faster if:
a) has_key = __contains__ #instead of yet another funccall
b) __getitem__ uses try except instead of double lookup key in map
-------
orm.mapper
Mapper._instance():
WTF is the **{'key':value, ... } ?
eg. if extension.populate_instance(self, context, row, instance,
**{'instancekey':identitykey, 'isnew':isnew}) ...
same thing is done as separate variable a page later;
btw there are several of these **{} in the file
also, Mapper._options is redundant (leftover?) neverused
-------
orm.attribute
AttributeManager.init_attr():
the saving this one eventualy does is too small, compared to a
property call of ._state.
AttributeManager.register_attribute():
the def _get_state(self) that is made into as property _state can
be made eventualy faster with try-except instead of 'if'.
btw: cant that ._state property be removed alltogether (i.e. made a
plain attribute? then init_attr() MUST be there seting it up as plain
dict.
-------
orm/unitofwork
UOWTask._sort_circular_dependencies():
def get_dependency_task(obj, depprocessor):
try:
dp = dependencies[obj]
except KeyError:
dp = dependencies.setdefault(obj, {})
isnt just the setdefault() enough?
-------
engine.url.
def translate_connect_args(self, names):
this assumes the order of passed names matches the order of
attribute_names inside... very fragile. Why not use set of kwargs
like (attr_name=replacement_name defaulting to None), then just use
the non empty ones?
def _parse_rfc1738_args():
the 'opts' dict is redundant, would be cleaner if args are just
passed to URL( name=value)
-------
topological.py
QueueDependencySorter.sort():
'cycles' is redundant neverused variable
-------
util:
ThreadLocal:
- wouldnt be faster if the key in the _tdict is tuple(id,key) and
not some formatted string off these? or the key is nonhashable?
- the engine/threadlocal.TLEngine._session() issues a hasattr() on
such object. how does it actualy work? IMO it always fails
======
hey, thanks for the MetaData.reflect()!
svil
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---