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

[REBOL] Re: More on expressions

From: carl:cybercraft at: 8-Feb-2003 14:20

On 08-Feb-03, Joel Neely wrote:
> Hi, Carl, > Here are the benchmark results: > Carl Read wrote: >> >> Well, yours will be the quicker, since it has a min or max >> less in it, but I'd be interested to know what kind of speed >> differences the parens make, so could you do a test of yours >> with them in as well?
[snip of the code and comments - see Joel's previous post]
> 100 sort network > 122.4 max of mins > 122.4 sort network (parens) > 167.7 any xor with default > 175.5 sum less extremes > 191.6 any all (w/ default) > 219 sums less twice max > 219.5 pick max remove max > 245.3 any all (explicit) > 250.8 second sort > 264.2 max of remove max > 338.1 int form remove extremes > 549.6 unwrapped sort with sets > Interestingly enough, adding the parens to the "sort network" > expression adds 20%-25% to the running time, which is essentially > the same cost as the extra min or max of the next alternative.
RT documentation suggests it's best to remove parens if possible due to speed reasons, which is partly why I asked the question. Those coming from compiled languages might expect no slowdown because of them and so leave them in for clarity, but this nicely shows that there can be quite a bit of cost to leaving them in. And thanks for doing the work Joel. I'm sure all here appreciate it. -- Carl Read