Re: [development] NULL testing and isset
development-request@drupal.org wrote:
Date: Tue, 17 Jan 2006 12:24:08 +0100 From: "Karoly Negyesi" <karoly@negyesi.net> Subject: [development] NULL testing and isset
Hi!
instead of === NULL use isset, please. Three times faster. If you are using !$foo for NULL testing (checking whether a static is set), then use isset, too. I have not checked how many times isset faster here but that's a language construct and it's a hell lot faster.
I tried it out. I looped through a check of === NULL and isset each 700000 times. The === NULL loop took an average of 1.57 secs, and == NULL was 1.68 secs. The !isset test was only 0.28 secs and empty at 0.25 secs on my Athlon 2400+. Using !$var was the fastest at 0.21 secs, though I think ! is sloppy and is the most difficult to tell what exactly is being tested. I'll keep my test script for a while if anyone wants to see (31 LOC).
participants (1)
-
David K Norman