swarm-support
[Top][All Lists]
Advanced

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

FCall/FArguments to speedup schedules (was Re: Speed decrease between 2


From: Paul Johnson
Subject: FCall/FArguments to speedup schedules (was Re: Speed decrease between 2.0 and 2.1?
Date: Tue, 23 May 2000 13:13:10 -0500

>     // Action looks ahead, decides to speed up or slow down
>     modelActions = [ActionGroup create: self];
> + #if 1
> +   [self forEachCar: M(ChangeLanes)];
> +   [self forEachCar: M(AdjustSpeed)];
> +   [self forEachCar: M(step)];
> + #else

Question:
1. I don't understand #if 1.  Do you compile with "make
EXTRACPPFLAGS=-D1" , treating 1 like a word?

2. Is this FCall approach more-or-less equivalent to caching the method
lookup in an IMP variable?  (as in
http://lark.cc.ukans.edu/~pauljohn/Swarm/IMP_Nextstep.txt).  It assumes,
does it not, that there are no nil or other kinds of objects in the
carList?  Even if a truck object could respond to the same message, it
would not be correct to use this because it would not be the same method
implementation for a truck as for a car?

3.  This speedup was in an earlier version of heatbugs that Marcus
showed me, and I went ballistic with "what the heck is this".  Marcus
gave me a nice explanation of it, which I will share with all of you who
are wondering "what the heck is this".  This writeup refers to a
slightly different usage, but I think the point is the same.

PJ> Can you put me in the loop?  I got no idea what this is for.  FCall?
PJ> FArguments?  What was wrong with the old way? 

And MD Said:
The old way lacks typing information.  It assumes all-the-world is an 
untyped "id".  This way lets you specify exact types for arguments
(e.g. you can pass doubles), and the return type.

   1. FArguments is a class for describing the arguments that are sent
      to a function or method in some language (so far Objective C and
Java).
      The particular usage in this case is:
      
        [FArguments create: self setSelector: M(step) setJavaFlag: NO]

      It means, "create a prototype for the arguments passed to
      the method `step', and don't worry about any Java-side method."

   2. FCall is a class for describing the actual invocation of a
function
      or method in some language.  The particular usage in this case is:

      [FCall create: self
             target: [heatbugList getFirst]
             selector: M(step)
             arguments:
               <above expression>]

      It means: "prepare a `step' message to send to a heatbug, passing
      the arguments described above".  Note: don't send it, just get
things
      ready.

   3. FAction is a kind of Action in the activity library.  It stands 
      for "Foreign Action", (the "F" in FCall also stands for
"foreign").
      The particular usage in this case is:

      [modelActions createFActionForEachHomogeneous: heatbugList call:
call];

      It means something more specific than what was in heatbugs before, 
      namely: "create a ForAction that will invoke the call configured
      above, with the knowledge that each item on the list is of the
      same type".  This is useful to communicate to Swarm, when
possible,
      because it means it doesn't have to look at the type of the item
      on each call.
  }
-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]