[Prev][Next][Index][Thread]

# Fixing a 1.8.0p5 performance misdesign (was Re: FUP)

- Date: Sat, 22 Feb 1997 11:18:50 PST
- From:
- cc: derbysa@server.uwindsor.ca, MOO-Cows.parc@xerox.com
- In-Reply-to: "Pavel Curtis's message of \"Wed, 24 Apr 1996 19:08:25 -0700\" <96Apr24.190825pdt.19566@silk.parc.xerox.com>anford.e"

    Pavel writes (around a year ago):

    > Fozzie writes:
    >> (Some of us can't upgrade to 1.8.0p?? since it uses too much CPU
    >> time.)

    > Can you say more about your basis for believing 1.8.0 to be
    > significantly slower than 1.7.9?  I am unaware of any field reports to
    > this effect.  Armed with a substantial report, I could at least check
    > into the reasons for any loss in speed and, perhaps, discover a
    > straightforward fix.

    Ben Jackson and I discovered that property lookups of
    $server_options.protected_foo were responsible for a substantial chunk
    of builtin function execution time.  One test showed 66% of all time
    spent in builtins going to this lookup.

    Since the .protected_foo properties have an average change rate of
    maybe one every couple months, I created a new entry in the builtin
    function structure to keep track of the protectedness, and added a new
    builtin, load_server_options(), that must be called after changes to
    $server_options.

    No whining about how gross load_server_options() is unless you have an
    alternative solution that isn't as gross.

    Jay

    *** MOO-1.8.0p5/functions.c	Thu Apr 18 21:20:48 1996
    --- MOO-1.8.0p5steak/functions.c	Mon Feb 10 00:38:13 1997
    ***************
    *** 78,83 ****
    --- 78,84 ----
          bf_type             func;
          bf_read_type	read;
          bf_write_type	write;
    +     int protected;
      };

      static struct bft_entry bf_table[MAX_FUNC];
    ***************
    *** 109,114 ****
    --- 110,116 ----
          bf_table[top_bf_table].func = func;
          bf_table[top_bf_table].read = read;
          bf_table[top_bf_table].write = write;
    +     bf_table[top_bf_table].protected = 0;

          if (num_arg_types > 0)
      	bf_table[top_bf_table].prototype =
    ***************
    *** 198,204 ****
      	/*
      	 * Check permissions, if protected
      	 */
    ! 	if (caller() != SYSTEM_OBJECT && server_flag_option(f->protect_str)) {
      	    /* Try calling #0:bf_FUNCNAME(@ARGS) instead */
      	    enum error e = call_verb(SYSTEM_OBJECT, f->verb_str, arglist, 0);

    --- 200,207 ----
      	/*
      	 * Check permissions, if protected
      	 */
    ! 	/* if (caller() != SYSTEM_OBJECT && server_flag_option(f->protect_str)) { */
    ! 	if (caller() != SYSTEM_OBJECT && f->protected) {
      	    /* Try calling #0:bf_FUNCNAME(@ARGS) instead */
      	    enum error e = call_verb(SYSTEM_OBJECT, f->verb_str, arglist, 0);

    ***************
    *** 417,426 ****
    --- 420,461 ----
          return make_var_pack(r);
      }

    + static void
    + load_server_protect_flags(void)
    + {
    +   int i;
    +
    +   for (i = 0; i < top_bf_table; i++) {
    +     bf_table[i].protected = server_flag_option(bf_table[i].protect_str);
    +   }
    +   oklog("Loaded protect cache for %d builtins\n", i);
    + }
    +
    + void
    + load_server_options(void)
    + {
    +   load_server_protect_flags();
    + }
    +
    + static package
    + bf_load_server_options(Var arglist, Byte next, void *vdata, Objid progr)
    + {
    +   free_var(arglist);
    +
    +   if (!is_wizard(progr)) {
    +     return make_error_pack(E_PERM);
    +   }
    +
    +   load_server_options();
    +
    +   return no_var_pack();
    + }
    +
      void
      register_functions(void)
      {
          register_function("function_info", 0, 1, bf_function_info, TYPE_STR);
    +     register_function("load_server_options", 0, 0, bf_load_server_options);
      }

      char rcsid_functions[] = "$Id: functions.c,v 2.6 1996/04/19 01:20:49 pavel Exp $";
    *** MOO-1.8.0p5/functions.h	Thu Apr 18 21:22:03 1996
    --- MOO-1.8.0p5steak/functions.h	Mon Feb 10 00:27:58 1997
    ***************
    *** 87,92 ****
    --- 87,94 ----
      				  Byte *bi_func_pc);
      extern Byte    *pc_for_bi_func_data(void);

    + extern void 	load_server_options(void);
    +
      #endif

      /* $Log: functions.h,v $
    *** MOO-1.8.0p5/server.c	Sun May 12 17:26:11 1996
    --- MOO-1.8.0p5steak/server.c	Mon Feb 10 00:26:22 1997
    ***************
    *** 1244,1250 ****

          if (!db_load())
      	exit(1);
    !
          SRANDOM(time(0));

          parent_pid = getpid();
    --- 1244,1252 ----

          if (!db_load())
      	exit(1);
    !
    !     load_server_options();
    !
          SRANDOM(time(0));

          parent_pid = getpid();

Follow-Ups:

- Re: Fixing a 1.8.0p5 performance misdesign (was Re: FUP)

- From: Cesar Silva <mentor@jinks.fe.up.pt>

- Prev: Re: fileio vs FUP
- Next: Re: Fixing a 1.8.0p5 performance misdesign (was Re: FUP)
- Index: MOO-cows
- Thread: MOO-cows

Home | Subject Index | Thread Index