Sequential access using 'for'

ashley thomas athomas at unity.ncsu.edu
Thu Jun 28 15:01:24 PDT 2001


>
>	- There's now a "for" statement to iterate over the indices of
>	  a table or the members of a set:
>
>		for ( i in foo )
>
>	  for the above "foo" will iterate with i assigned to 1, 2, and 3;
>	  *but not in general in that order*.
>

I need to traverse the table sequentially (upwards and downwards). 
However it seems that the 'for' command does not do that.

Did you mean the same thing when you said :
"*but not in general in that order*"

Also is there any workaround so that i can access the table sequentially.

regards
Ashley



> Since "for" construct was not there in bro, i was using "recursive"
> function calls in my script.
> But now that "for" loop construct is there, i can use that.
> 
> I want to know how much will i gain by doing that. because presently i am using 0.7a48 and i have to do some additional changes to 0.7a62 before i can use that.
> 
> I am using the recursive call for almost 512 rounds. so i guess there will be a tremendous change if i use for loop instead , right ?

The for loop ought to be a lot more efficient, yes.  But what you gain will
of course depend on how much your performance is currently dominated by the
recursive calls.

		Vern

Ashley Thomas
1713 Crest road #1
Raleigh NC 27606
phone (919)-829-3576



More information about the Bro mailing list