An experiment trying to reduce number change/update events jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 23 Feb 2012 12:18:37 +0000
branchjv
changeset 17925 28b8874335e6
parent 17924 407731f7a67d
child 17926 2b7976260ae3
An experiment trying to reduce number change/update events
Smalltalk.st
libInit.cc
--- a/Smalltalk.st	Wed Feb 22 13:25:29 2012 +0000
+++ b/Smalltalk.st	Thu Feb 23 12:18:37 2012 +0000
@@ -25,7 +25,8 @@
 		ImageStartTime ImageRestartTime DemoMode SaveEmergencyImage
 		SpecialObjectArray CallbackSignal KnownPackages
 		ClassesFailedToInitialize HasNoConsole IgnoreHalt
-		PackageToPathMapping'
+		PackageToPathMapping TimeOfLastChangeEvent
+		NumberOfChangeEventsInLast200msecs'
 	poolDictionaries:''
 	category:'System-Support'
 !
@@ -1170,6 +1171,37 @@
     "
 ! !
 
+!Smalltalk class methodsFor:'change & update'!
+
+changed: what with: param
+    "Trigger a change event"
+
+    | ts |
+
+    "Experimental!!!!!!
+     Do not trigger many events if they're comming to fast"
+    ts := OperatingSystem getMillisecondTime.
+    TimeOfLastChangeEvent isNil ifTrue:[
+        TimeOfLastChangeEvent := ts.
+        NumberOfChangeEventsInLast200msecs := 0.
+        super changed: what with: param.
+        ^self.
+    ].
+    (ts - TimeOfLastChangeEvent) < 500"msecs" ifTrue:[
+        NumberOfChangeEventsInLast200msecs < 10 ifTrue:[
+            NumberOfChangeEventsInLast200msecs := 
+                NumberOfChangeEventsInLast200msecs + 1.
+            super changed: what with: param.
+        ].
+        ^self.
+    ].
+    TimeOfLastChangeEvent := ts.
+    NumberOfChangeEventsInLast200msecs := 0.
+    super changed: what with: param.
+
+    "Modified: / 23-02-2012 / 11:35:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !Smalltalk class methodsFor:'class management'!
 
 changeCategoryOf:aClass to:newCategory
@@ -7758,21 +7790,13 @@
 !Smalltalk class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.989 2012/02/14 14:25:42 cg Exp $'
+    ^ '$Id: Smalltalk.st 10783 2012-02-23 12:18:37Z vranyj1 $'
 !
 
 version_CVS
-    ^ 'Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.989 2012/02/14 14:25:42 cg Exp '
+    ^ '§Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.989 2012/02/14 14:25:42 cg Exp §'
 !
 
 version_SVN
-    ^ '$Id: Smalltalk.st 10779 2012-02-14 22:03:08Z vranyj1 $'
+    ^ '$Id: Smalltalk.st 10783 2012-02-23 12:18:37Z vranyj1 $'
 ! !
-
-
-
-
-
-
-
-
--- a/libInit.cc	Wed Feb 22 13:25:29 2012 +0000
+++ b/libInit.cc	Thu Feb 23 12:18:37 2012 +0000
@@ -1,5 +1,5 @@
 /*
- * $Header: /cvs/stx/stx/libbasic/libInit.cc,v 1.176 2012/01/24 16:19:51 cg Exp $
+ * $Header$
  *
  * DO NOT EDIT
  * automagically generated from the projectDefinition: stx_libbasic.
@@ -133,7 +133,6 @@
 _CharacterEncoderImplementations__ISO8859_1372_Init(pass,__pRT__,snd);
 _CharacterEncoderImplementations__ISO8859_1375_Init(pass,__pRT__,snd);
 _CharacterEncoderImplementations__ISO8859_1377_Init(pass,__pRT__,snd);
-_CharacterEncoderImplementations__JIS0208_137to_137SJIS_Init(pass,__pRT__,snd);
 _CharacterEncoderImplementations__MS_137Ansi_Init(pass,__pRT__,snd);
 _ClassDescription_Init(pass,__pRT__,snd);
 _Complex_Init(pass,__pRT__,snd);
@@ -256,6 +255,7 @@
 _SignalError_Init(pass,__pRT__,snd);
 _SmallInteger_Init(pass,__pRT__,snd);
 _SmalltalkChunkFileSourceWriter_Init(pass,__pRT__,snd);
+_SomeNumber_Init(pass,__pRT__,snd);
 _StreamError_Init(pass,__pRT__,snd);
 _SubclassResponsibilityError_Init(pass,__pRT__,snd);
 _TimeoutError_Init(pass,__pRT__,snd);
@@ -322,7 +322,6 @@
 _PipeStream_Init(pass,__pRT__,snd);
 _Symbol_Init(pass,__pRT__,snd);
 _Unicode16String_Init(pass,__pRT__,snd);
-_SomeNumber_Init(pass,__pRT__,snd);
 #ifdef UNIX
 _UnixFileDescriptorHandle_Init(pass,__pRT__,snd);
 _UnixFileHandle_Init(pass,__pRT__,snd);
@@ -343,4 +342,3 @@
 
 __END_PACKAGE__();
 }
-