[development] NULL testing and isset
David K Norman
deekayen at deekayen.net
Tue Jan 17 15:26:17 UTC 2006
development-request at drupal.org wrote:
> Date: Tue, 17 Jan 2006 12:24:08 +0100
> From: "Karoly Negyesi" <karoly at negyesi.net>
> Subject: [development] NULL testing and isset
> 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
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
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).
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 188 bytes
Desc: not available
Url : http://lists.drupal.org/pipermail/development/attachments/20060117/be2b4f79/deekayen.vcf
More information about the development