So, when remotely displaying from my sparc to a machine on the same lan
it takes 48 seconds to bring up the first window.  This change to
genrand.c (rolling orbit2's genuid_simple in, and using that when
buf_len is 8 or more) drops it down to 18 seconds.

Displaying locally the time after the patch is 12 seconds from start to
first window, so there's probably still some room for improvement
elsewhere.

Doesn't appear to noticeably change freebsd's startup time (it was ~4-5
seconds before and after the change).

Chris

Index: genrand.c
===================================================================
RCS file: /cvs/gnome/ORBit/src/orb/genrand.c,v
retrieving revision 1.2.4.1
diff -u -r1.2.4.1 genrand.c
--- genrand.c   18 Jan 2001 20:16:44 -0000      1.2.4.1
+++ genrand.c   19 Apr 2002 00:01:05 -0000
@@ -29,6 +29,44 @@
   return TRUE;
 }
 
+static void
+orbit2_xor_buffer (guchar *buffer, int length)
+{
+       static glong   s = 0x6b842128;
+       glong          i, t;
+       GTimeVal       time;
+
+       g_get_current_time (&time);
+
+       t = time.tv_sec ^ time.tv_usec;
+
+       for (i = 0; i < length; i++)
+               buffer [i] ^= (guchar) (s ^ (t << i));
+
+       s ^= t;
+}
+
+static gboolean
+orbit2_genrand_simple(guchar *buffer, int buf_len)
+{
+       static guint32 inc = 0;
+       pid_t pid = getpid();
+
+       if (buf_len < 8)
+         return;
+
+       memset (buffer, 0, buf_len);
+
+       inc++;
+
+       memcpy (buffer, &inc, 4);
+       memcpy (buffer + 4, &pid, 4);
+
+       orbit2_xor_buffer (buffer, buf_len);
+
+       return TRUE;
+}
+
 static volatile int received_alarm = 0;
 
 static void
@@ -105,6 +143,8 @@
   g_return_if_fail(buf_len);
 
   if(genrand_dev(buffer, buf_len))
+    return;
+  else if(orbit2_genrand_simple(buffer, buf_len))
     return;
   else if(genrand_unix(buffer, buf_len))
     return;

Reply via email to