summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Constants.pm
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-07-09 04:00:31 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-07-09 04:00:31 +0200
commit30084ede70b1f17b620f5bb5d38ccabb3321f5df (patch)
treee55efb88fa4db408220e73d0279702ed35af7403 /Bugzilla/Constants.pm
parent3f40ba04a7bdea2f3f84202006cc55054d647afb (diff)
downloadbugzilla-30084ede70b1f17b620f5bb5d38ccabb3321f5df.tar.gz
bugzilla-30084ede70b1f17b620f5bb5d38ccabb3321f5df.tar.xz
Bug 576670: Optimize Search.pm's "init" method for being called many times
in a loop r=glob, a=mkanat
Diffstat (limited to 'Bugzilla/Constants.pm')
-rw-r--r--Bugzilla/Constants.pm15
1 files changed, 10 insertions, 5 deletions
diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm
index d58fe9388..2285f89b0 100644
--- a/Bugzilla/Constants.pm
+++ b/Bugzilla/Constants.pm
@@ -35,6 +35,7 @@ use base qw(Exporter);
# For bz_locations
use File::Basename;
+use Memoize;
@Bugzilla::Constants::EXPORT = qw(
BUGZILLA_VERSION
@@ -404,11 +405,11 @@ use constant EMPTY_DATETIME_REGEX => qr/^[0\-:\sA-Za-z]+$/;
# See the POD for Bugzilla::Field/is_abnormal to see why these are listed
# here.
-use constant ABNORMAL_SELECTS => qw(
- classification
- product
- component
-);
+use constant ABNORMAL_SELECTS => {
+ classification => 1,
+ component => 1,
+ product => 1,
+};
# The fields from fielddefs that are blocked from non-timetracking users.
# work_time is sometimes called actual_time.
@@ -619,4 +620,8 @@ sub bz_locations {
};
}
+# This makes us not re-compute all the bz_locations data every time it's
+# called.
+BEGIN { memoize('bz_locations') };
+
1;