1. faster find_all()

Using this routine, I get about a 20% increase in speed over Gabriel's 
version that's in strtok.e


sequence find_all_list     find_all_list={}
function find_all(object value, sequence s)
 integer lc
   lc = 0
   if length(find_all_list) < length(s) then
      find_all_list &=repeat(0,length(s)-length(find_all_list))
   end if
   for i = 1 to length(s) do
      if equal(value, s[i]) then
         lc +=1
         find_all_list[lc] = i
      end if
   end for
   return find_all_list[1..lc]
end function

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu