]> sourceware.org Git - automake.git/commitdiff
* lib/Automake/Item.pm (def): Rewrite more concisely, it's faster
authorAlexandre Duret-Lutz <adl@gnu.org>
Thu, 5 Aug 2004 23:01:24 +0000 (23:01 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Thu, 5 Aug 2004 23:01:24 +0000 (23:01 +0000)
this way.

ChangeLog
lib/Automake/Item.pm

index 41b19db0171c2133d1b1ce3d33bd5ddf12793b22..bbe0b91f398e56aa8a9b51066cd24e09fb3297a5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-08-06  Alexandre Duret-Lutz  <adl@gnu.org>
+
+       * lib/Automake/Item.pm (def): Rewrite more concisely, it's faster
+       this way.
+
 2004-08-05  Alexandre Duret-Lutz  <adl@gnu.org>
 
        Speed up make_paragraphs.
index 02ea8dea77e54e4ce0cc6c926823b0f118548fdb..6dc3b24d5086faf7ea1b7a7b4a1f3956455e9761 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004  Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -71,9 +71,12 @@ exists.  Return 0 otherwise.
 
 sub def ($$)
 {
-  my ($self, $cond) = @_;
-  return $self->{'defs'}{$cond} if exists $self->{'defs'}{$cond};
-  return 0;
+  # This method is called very often, so keep it small and fast.  We
+  # don't mind the extra undefined items introduced by lookup failure;
+  # avoiding this with `exists' means doing two hash lookup on
+  # success, and proved worse on benchmark.
+  my $def = $_[0]->{'defs'}{$_[1]};
+  return defined $def && $def;
 }
 
 =item C<$item-E<gt>rdef ($cond)>
This page took 0.037657 seconds and 5 git commands to generate.