swarm-support
[Top][All Lists]
Advanced

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

fast Actions in Java


From: Marcus G. Daniels
Subject: fast Actions in Java
Date: 01 Jul 2001 19:20:57 -0600
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.7

In the common case of one or more step methods that get called
frequently, if you you use at$createFAction instead at$createActionTo
you can improve performance by significantly reducing the overhead of
firing the Action.

In the latest snapshot, there are optimizations to further improvement
the performance of this approach.

Here's a method that creates an FAction for no-argument methods.  You
call it like so:

  schedule.at$createFAction (t, createCall ("step"));

public FCall createCall (String name) {
    try {
        Selector sel = new Selector (getClass (), name, false);
            
        FArguments fa = new FArgumentsImpl (getZone (), sel);
            
        return new FCallImpl (getZone (), this, sel, fa);
    } catch (Exception e) {
        e.printStackTrace (System.err);
        System.exit (1);
    }
    return null;
}

The reason createFAction is faster than createActionTo is because the
latter requires Swarm to forward the call and then re-issue it in
Java.  When a FAction is fired for a Java method, it involves only a
function call.  (Then, there are costs inside the Java VM or runtime,
but those can't be avoided.)

                  ==================================
   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]