Contact: fumanchu@aminus.org

Log in as guest/dejavu to create tickets

I think I've seen this ORM somewhere before...

Changeset 331

Show
Ignore:
Timestamp:
12/04/06 22:19:22
Author:
fumanchu
Message:

Speed hack inside StorageManagerDB.consume.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/storage/db.py

    r330 r331  
    128128     
    129129    def consume(self, unit, key, value, dbtype): 
     130        """Set 'value' (of type 'dbtype') as a valid property on the unit.""" 
    130131        try: 
    131             prop = unit.__class__.property(key) 
     132            # Skip the "property" classmethod to save a function call 
     133            # (which is ~4x slower). 
     134            # If someone overrides Unit.property, this will break 
     135            # their app, but it's called *so* often it seems worth it. 
     136##            prop = unit.__class__.property(key) 
     137            prop = getattr(unit.__class__, key) 
     138             
    132139            pytype = prop.type 
    133140            cvalue = self.db.adapterfromdb.coerce(value, dbtype, pytype)