Warning: Creating default object from empty value in /home/davancamus/public_html/blog/wp-includes/functions.php on line 292
Royal Cavorite Society » Blog Archive » LSL Listener Lag?

LSL Listener Lag?

January 2nd, 2007 by Davan Camus

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/davancamus/public_html/blog/wp-includes/functions-formatting.php on line 76

It seems to be “common knowledge” that “listeners cause lag”. That is, you’re “supposed” to avoid having too many open listeners, especially on channel zero. (A listener is any script which can respond to spoken chat commands.)

Just to put things into perspective I’ll quote an offhand remark of Philip Rosedale’s when asked, Does such and so cause lag? His reply: “Well, of course, everything causes lag.”

A very brief, informal experiment suggests that a smallish number of listeners makes no significant impact on sim performance. Normally, Simulator Time Ratio at the Caledon Moors blinks between 99% and 100%, with occasional excursions to 80% or even 75%.

Rezzing 3 continuous shouters and 64 listeners didn’t seem to change that. I don’t have any graphs or collected data, just an informal observation. A more systematic investigation is of course needed.

(Obviously I chose a snapshot that shows 100%… but that’s where it mostly was.)

Shouter code:

default
{
    state_entry()
    {
        llSetText(\"shout 888\",<1,1,1>,1);
        while(1)
            llShout(888,\"testing\");
    }
}

Listener code:

integer gCount = 0;
key gOwner;
	
default
{
    state_entry()
    {
        llListen(888,\"\",\"\",\"\");
        llSetTimerEvent(1 + llFrand(.4));
        gOwner = llGetOwner();
    }
	
    timer()
    {
        llSetText(\"listen 888\n\" + (string)gCount,<1,1,1>,1);
    }
	
    listen(integer channel,string name,key id,string message)
    {
        llMessageLinked(-1,888,message,id); // just to do something
        gCount++;
        if(id == gOwner)
            gCount = 0;
    }
}

One Response to “LSL Listener Lag?”

  1. Aden Davids Says:

    Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/davancamus/public_html/blog/wp-includes/functions-formatting.php on line 76

    It’s slightly wrong to say that listeners cause lag. But listeners likely do add to a sim’s processor load. Lag happens when a sim’s processor is overloaded. So adding scripts that require extra (unneeded?) processing power don’t necessarily cause lag.

    Here’s an unrealistic example. Suppose you had a sim with nothing but a single prim that said “Hello Avatar” once a second. It’s a pretty safe bet there’d be zero lag. If you had two of them, still absolutely no lag. Same with three, four, etc. But if you kept adding them, at some point you’d have enough to cause just a smidgen of lag. If you kept going, [b]then[/b] lag would increase with each prim/script you added.

    So this experiment shows is that 64 listeners isn’t enough to trigger lag. But it does not disprove the proposition that listeners add significantly to processor load.

Leave a Reply