Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Series comparison techniques

From: atruter:labyrinth:au at: 14-Aug-2003 16:11

Hi Andrew,
> I think you'll find that you're measuring the difference in time between > "if equal? series/:pos value" and the internal operation of "find series > value". Native! values are faster than mezzanine functions.
How so? EQUAL?, IF and REPEAT are all native! functions. Cutting the search-series function down to a bare minimum, as in: <code> find-value2: func [series [series!] value] [ clear rowids start: now/time/precise repeat pos length? series [ if series/:pos = value [insert tail rowids pos] ] print now/time/precise - start rowids ] </code> is about 10% faster (.125, 1.219 and 12.156 respectively) but still not in the same league as find. Find seems able to iterate over a series of values faster than a loop (which I understand) but it also seems to take less time [per value] as more values are present (which is what I do not understand). More is less, but how? Regards, Ashley