egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[bind] efficiency, multiple binds or * pubm/msgm?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
incith
Master


Joined: 23 Apr 2005
Posts: 275
Location: Canada

PostPosted: Fri Dec 26, 2008 11:24 am    Post subject: [bind] efficiency, multiple binds or * pubm/msgm? Reply with quote

Hello all,

A bit of a debate (you make life difficult mezzanine! But I can't help but <3 you) has raised over how I do the binds in my horoscope script, using a mass [foreach] to bind all the signs to pub and msg binds. This, obviously, creates a very large [binds] list.

The alternative is using a * pubm/msgm and checking each line of text against every bind (I foresee another foreach and regexp/string matching), on every single line of text that is said. This is basically what eggdrop does anyway, no? Checking each line against it's binds list.

So I'm wondering what do you think would yield better performance, using individual binds and letting eggdrop do the work, or using pubm and checking the binds on the script level? Consider large/small channels etc, or bots on many channels.
_________________
; Answer a few unanswered posts!
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri Dec 26, 2008 5:02 pm    Post subject: Reply with quote

Interesting subject. Lets try to analyze this theoretically (this is only my assumption and is not necessarily true); When using a pub bind, Eggdrop does actually do the matching but I suppose it's faster than matching using Tcl in a pubm procedure. However, a huge [binds] list means more memory usage but that shouldn't be an issue if we're just talking about what? 50 binds maximum? so, in my opinion, even in a large channel with much traffic... using pub would be better in terms of performance than pubm... but that should be put for testing of course.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
incith
Master


Joined: 23 Apr 2005
Posts: 275
Location: Canada

PostPosted: Sat Dec 27, 2008 12:36 am    Post subject: Reply with quote

That is how I'm looking at it too.

Basically the main example would be my horoscope script, and in 3.0 you can set multiple commands chars, and with the option to bind signs (sorry not bragging here >_>), this adds up to 50ish binds or so (with 2 commands chars).
_________________
; Answer a few unanswered posts!
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Dec 28, 2008 10:36 am    Post subject: Reply with quote

so we're talking 50 to 100 binds? how much memory does that take up? not more than 2 or 3KB if I'm not mistaken so that's not at all to be considered as a load.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
incith
Master


Joined: 23 Apr 2005
Posts: 275
Location: Canada

PostPosted: Mon Dec 29, 2008 2:24 pm    Post subject: Reply with quote

Well, 50 with 2 command chars (most people will use 1). Let's just say anyway that your eggdrop had 100 binds active.

If eggdrop is doing it, I picture eggdrop running a big foreach {} kind of thing against all the binds it has stored. If you start using pubm and binding to *, then you start having nested foreach {}'s, while eggdrop loops through its bind list, and then a foreach in your script to check the binds, and then back into the eggdrop loop, etc. I can't help but think it would be most optimized by having eggdrop do as much of the work as possible.
_________________
; Answer a few unanswered posts!
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Wed Dec 31, 2008 6:32 am    Post subject: Reply with quote

Actually, all eggdrop does is iterate through a linked list of structs. The speed of this cannot be matched by any construction in tcl involving any kind of loops.

As for the memory consumption, the footprint of the structs would not be considderably larger than the footprint of the proc that would do the "msgm/pubm version".

Personally, the only "issue" I could possibly see with using multiple msg/pub bindings, is that they do not stack, whereas msgm/pubm does. Unless you think seeing 50-100 extra lines when using the .binds command is an issue Wink
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber