[KSS-checkins] r42414 - kukit/kukit.js/branch/performance_improvement/kukit

reebalazs at codespeak.net reebalazs at codespeak.net
Sat Apr 28 22:26:01 CEST 2007


Author: reebalazs
Date: Sat Apr 28 22:25:59 2007
New Revision: 42414

Modified:
   kukit/kukit.js/branch/performance_improvement/kukit/commandprocessor.js
   kukit/kukit.js/branch/performance_improvement/kukit/kukit.js
Log:
Make the binding of the nodes together in one batch after all
insertions of a commands arriver with a response are done, instead of
doing after each insertion as currently.

Modified: kukit/kukit.js/branch/performance_improvement/kukit/commandprocessor.js
==============================================================================
--- kukit/kukit.js/branch/performance_improvement/kukit/commandprocessor.js	(original)
+++ kukit/kukit.js/branch/performance_improvement/kukit/commandprocessor.js	Sat Apr 28 22:25:59 2007
@@ -101,6 +101,7 @@
 };
 
 kukit.cp.CommandProcessor.prototype.executeCommands = function(oper) {
+    kukit.engine.beginSetupEventsCollection();
     // node, eventrule, binderinstance are given on oper, in case
     // the command was called up from an event
     if (typeof(oper) == 'undefined' || oper == null) {
@@ -120,5 +121,6 @@
             }
         }
     }
+    kukit.engine.finishSetupEventsCollection();
 };
 

Modified: kukit/kukit.js/branch/performance_improvement/kukit/kukit.js
==============================================================================
--- kukit/kukit.js/branch/performance_improvement/kukit/kukit.js	(original)
+++ kukit/kukit.js/branch/performance_improvement/kukit/kukit.js	Sat Apr 28 22:25:59 2007
@@ -43,6 +43,10 @@
     // instantiate a load scheduler
     this.loadScheduler = new kukit.rd.LoadActions();
     this.initializedOnDOMLoad = false;
+    // setup events queuing, collect them at the end of commands
+    this.setupEventsQueue = [];
+    this.setupEventsInProgress = false;
+
 };
 
 kukit.Engine.prototype.calculateBase = function() {
@@ -111,6 +115,27 @@
 };
 
 kukit.Engine.prototype.setupEvents = function(in_nodes) {
+    if (this.setupEventsInProgress) {
+        // remember them
+        this.setupEventsQueue = this.setupEventsQueue.concat(in_nodes);
+    } else {
+        // do it
+        this.doSetupEvents(in_nodes);
+    }
+};
+
+kukit.Engine.prototype.beginSetupEventsCollection = function() {
+    this.setupEventsInProgress = true;
+};
+
+kukit.Engine.prototype.finishSetupEventsCollection = function() {
+    this.setupEventsInProgress = false;
+    var setupEventsQueue = this.setupEventsQueue;
+    this.setupEventsQueue = [];
+    this.doSetupEvents(setupEventsQueue);
+};
+
+kukit.Engine.prototype.doSetupEvents = function(in_nodes) {
     var self = this;
     var deferred_setup_events = function() {
         self._setupEvents(in_nodes);


More information about the Kukit-checkins mailing list