Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Agent vs. Rules and CPU efficiency (Read 6147 times)
Allan Tsai
Full Member
*
Offline



Posts: 41

Agent vs. Rules and CPU efficiency
Oct 16th, 2008, 12:55pm
 
I want to implement some complex conditional actions based on attribute values.

Is it better to put the complexity at the note level by adding it to the Rule section of a note prototype, or should I try to move the complexity to a set of agents?

For example: I have a user attribute named "due" of type "date." If due=today a want to color the note and move it to another container. But if i want to change the "due" date of a note where due already = today, TB will reverse the coloring and move it to a different container.

Do notes constantly check their Rules like agents do? Or do they only check when an attribute changes? I know that Agents check constantly depending on their priority. Which is more efficient CPU-wise?

Are there other pitfalls of doing one or the other?
Back to top
 
 

Tinderbox 4.7.1
Macbook Pro 2.4Ghz Intel Core 2 Duo, 4GB RAM
OS X 10.6.1
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Agent vs. Rules and CPU efficiency
Reply #1 - Oct 16th, 2008, 3:10pm
 
You can switch agents off, and you can reduce the priority of individual agents. You can't do that with rules.

Agents always start by looking at every note.  But a Rule only looks at one note -- itself.  Sometimes, it's easier to attach a rule to a small number of notes than to write an agent.

The new AgentManager in Tinderbox 4.5 makes agent updates just about as efficient as rules.
Back to top
 
 
WWW   IP Logged
Allan Tsai
Full Member
*
Offline



Posts: 41

Re: Agent vs. Rules and CPU efficiency
Reply #2 - Oct 16th, 2008, 8:09pm
 
Am I correct in thinking then that having one or more agents  perform functions on notes is more efficient than having a bunch of notes checking their own complex rules?

I'm just worried about crippling the performance of a document with a bunch of notes with complex notes running around.
Back to top
 
 

Tinderbox 4.7.1
Macbook Pro 2.4Ghz Intel Core 2 Duo, 4GB RAM
OS X 10.6.1
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Agent vs. Rules and CPU efficiency
Reply #3 - Oct 17th, 2008, 11:48am
 
It depends completely on what you're doing.  

When lots of notes have rules, those rules tend to be inherited from prototypes -- and so they're only compiled once.  But agents can often be very specific -- a query like "#inside(NewBooks)" runs quickly if NewBooks is a small container.

A little algorithmic analysis will go a long way here. How many notes will your rules need to examine?  How many notes will your agents need to examine?  How complex is the condition that they'll be checking?
Back to top
 
 
WWW   IP Logged
Pages: 1
Send Topic Print