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
eval() slows down agent (Read 3649 times)
Hinnerk Haardt
Full Member
*
Offline



Posts: 2

eval() slows down agent
Mar 11th, 2009, 11:56am
 
after adding an new agent the agent update time of one of my documents (Tinderbox 4.6.0, 2200 notes, 38 agents, 550 links, 21 attributes, ~13 seconds agent update time) increased by ~3 seconds.

I found out that by removing two layers of indirection the time for that agent went down to 700mS. The AgentQuery did first look like this:

eval($SuchHelfer("A"))&($Prototype(parent(original))="Projekt")

where

$SuchHelfer("A")='(Wartend=false&eval($SuchHelfer("B")))'

and

$SuchHelfer("B")='(descendedFrom("Projektsammlung")|descendedFrom("Eingang"))'

This gets much faster when replacing eval() with the respective value:

(Wartend=false&(descendedFrom("Projektsammlung")|descendedFrom("Eingang")))&($Pr
ototype(parent(original))="Projekt")


I guess eval() in an AgentQuery has to be evaluated for every possible match as the result could change during the run. I'm now looking for a faster way to to reuse tt in AgentQueries since it does not only make the query easier to read but also lets me change things much easier.
Do you see any way to do that without using eval()?
Back to top
 
 
  IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: eval() slows down agent
Reply #1 - Mar 11th, 2009, 12:16pm
 
Yes: eval is terribly inefficient when used in queries.

The best way to handle this, I think, is to create three agents:

1) SuchHelferB:descendedFrom("Projektsammlung")|descendedFrom("Eingang")
2) SuchHelfeA: inside(suchHelferB)&(Wartend=false)
3) the answer: inside(suchHelferA)& Prototype(parent(original))="Projekt"

This is as easy to maintain as the multiple evals, and much more efficient.  Better still, you might be able to reuse one of the utility agents in another agent, saving yet more work.

Back to top
 
 
WWW   IP Logged
Hinnerk Haardt
Full Member
*
Offline



Posts: 2

Re: eval() slows down agent
Reply #2 - Mar 11th, 2009, 1:56pm
 
impressive: After spring cleaning (I removed 10 outdated agents and switched most to low priority) and following your advice (basically every other agent now queries inside(P&E)) the agent update time now is about 1400mS. That means I now can re-enable "update agents automatically".

A really big thanks!


Hinnerk
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print