News for hackers. Stuff that matters.
Re:40 Tips for optimizing your php Code by andreyf on Tuesday October 16, 2007 @05:32AM (#68448)
Oh, of course - range() is evaluated once in either case. It returns an array, which is then stepped through. The time difference must have been just some inaccuracy. I guess 'time' isn't the best command to use to test efficiency ... or maybe try adding another 0?
Re:40 Tips for optimizing your php Code by ratsbane on Tuesday October 16, 2007 @08:30AM (#68477)
Oh, thanks. I redid it using xrange instead of range and the numbers went down to an average (over 20 tries) of about 1.36 sec for maxval1 (which computes endpoint within the xrange) and 1.9 sec for maxval2 (which uses variable in xrange.)