After some fiddeling I found this combination of the disposer methods to be about 5 times faster then the version in Object.js. One change is that in the class method dispose there is just a call to dispose if the object has the attribute _disposed = false and the entry of the object in the _db array is nullyfied just in the dispose instance method not a second time in the dispose class method.
Another change was to do just assignments with null and not calling the delete operator.

Please have a look if I missed something here. If it is ok I'll be happy to create a patch.

qx.core.Object.prototype.dispose = function() {
  if (this.getDisposed()) {
    return;
  }

  // Dispose user data
  if (this._userData)
  {
    for(var vKey in this._userData) {
      this._userData[vKey] = null;
    }

    this._userData = null;
  }

  // Finally cleanup properties
  if (this._objectproperties)
  {
    var a = this._objectproperties.split(qx.constant.Core.COMMA);
    var i, l;
    for (i=0, l=a.length; i<l; i++) {
      this[qx.OO.values[a[i]]] = null;
    }

    this._objectproperties = null;
  }

  // Delete Entry from Object DB
  //
  qx.core.Object._db[this._hashCode] = null;

  this._disposed = true;
}

qx.core.Object.dispose = function()
{
  var vObject;

  for (var i=qx.core.Object._db.length-1; i>=0; i--)
  {
    vObject = qx.core.Object._db[i];

    if (vObject != null && vObject._disposed === false )
    {
      vObject.dispose();
    }
  }
}




Dietrich Streifert schrieb:
I did an additional test:

  // Finally cleanup properties
  if (this._objectproperties)
  {
    var a = this._objectproperties.split(qx.constant.Core.COMMA);
    for (var i=0, l=a.length; i<l; i++) {
      var tmp = this[qx.OO.values[a[i]]];
    }

    delete this._objectproperties;
  }

So the property is not deleted nor nullifyd it is accessed and assigned to a temporary variable. The performance is the same as deleting or assigning null. So I assume the access to the property by calling:
   
    this[qx.OO.values[a[i]]];

is slow.


Andreas Junghans schrieb:
Am 01.08.2006 um 17:26 schrieb Sebastian Werner:

  
Dietrich Streifert schrieb:
    
Sebastian Werner schrieb:
      
So the performance impact comes from the for-loop. I think there  
is no
chance to make this greatly better. It's just a loop. Maybe the  
delete
operator is that bad.
        

for loops where one of the critical points in my tests with lots of  
objects (the IE garbage collector problem). It shouldn't affect  
Firefox though.

  
So just nullifying the attributes is not enough, right?

this[qx.OO.values[a[i]]] = null;
      
It's the same. And should have the identical performance.
    

Not really. Delete actually removes the key from the internal hash  
map of the object. Setting the value to null only changes the value  
but leaves the collection of keys alone. I'd expect delete to work  
slower than nulling the references, but I didn't test it.

Regards,

   Andreas


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
  

-- 
Mit freundlichen Grüßen
Dietrich Streifert
Visionet GmbH
  

------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

-- 
Mit freundlichen Grüßen
Dietrich Streifert
Visionet GmbH
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to