|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
06-08-2007 03:10
Having the ignoble task of building a small farm of a few dozen individual avatar detectors, I have to decide whether to sense all the agents in one central sensor scan and sift through the results for matches and updating by link messages, or a whole bunch of keyed per-avatar sensor scans in the detector prims themselves.
Initially I thought the single sensor would be better, but on further contemplation, I realized that the sensor implementation may be a whole lot more efficient than any LSL bytecode in sifting through the results for "my" avatars.
Any other intuitions, or relevant performance data?
|
|
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
|
06-08-2007 06:13
Some thoughts:
- Trying to imagine what really happens behind the scenes, I would think in this case the singl e call would be more efficient than multiple ones, as each call would potentially require more overhead and process swap.
- But it may also depend a lot on how many avs you are scanning for, and how many are typically in the area. For instance, a single call may be more efficient for a small number of avs in the area, and multiple calls for a large number (or vice versa).
- Putting aside the potential for lag, which would make the script more clear and easier to maintain?
|
|
Jake Trenchard
Registered User
Join date: 31 May 2007
Posts: 104
|
06-08-2007 06:32
In general, if you have a call that does a task or you can do the task yourself, use the call that does the task. It's easier on you, and compilers can be much, much better at optimizing than human beings. This is why high level languages continue to thrive and we aren't all still writing in assembly language.
|
|
Travis Lambert
White dog, red collar
Join date: 3 Jun 2004
Posts: 2,819
|
06-08-2007 21:23
If you can get away with it, I'd say a filtered sensor, with a long scan rate would be the most sim-friendly. Part of the reason I believe sensors are so expensive, is because of detected* bloat. The sheer volume of data the simulator must return on every scan must carry with it a certain degree of load. As a side note, there is a Jira request for improved sensor functions that are optimized for specific purposes here: https://jira.secondlife.com/browse/SVC-58Take a look, and if it appears useful, give it a vote! 
_____________________
------------------ The ShelterThe Shelter is a non-profit recreation center for new residents, and supporters of new residents. Our goal is to provide a positive & supportive social environment for those looking for one in our overwhelming world.
|
|
Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
|
06-08-2007 22:56
Don't forget that a sensor only returns a limited amount of detected objects that fit the filters, think it's 14 (but not looking it up). So if you have more then 14 AV's around, you won't sense all of them with one sensor sweep.
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
06-09-2007 02:45
From: Lazink Maeterlinck Don't forget that a sensor only returns a limited amount of detected objects that fit the filters, think it's 14 (but not looking it up). So if you have more then 14 AV's around, you won't sense all of them with one sensor sweep. Ah, thanks! Completely forgot about that--even though I've been bitten by it before--and it makes all the difference. (Couldn't find the actual number in the wiki, but for what it's worth, empirical evidence suggests it's 16)
|