Closed Bug 696541 Opened 13 years ago Closed 13 years ago

Only load some external modules when needed, to improve the load time of pages

Categories

(Bugzilla :: Bugzilla-General, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.4

People

(Reporter: LpSolit, Assigned: LpSolit)

Details

(Keywords: perf)

Attachments

(1 file)

When loading one of the simplest template, index.cgi, it's possible to decrease the load time by 200ms (from 920 to 720ms) using various small improvements:

- Only load DateTime when needed, see bug 696537.
- Do not use IO::File in Bugzilla::RNG to generate the seed. IO::File is known to be slower than a simple open(), read(), close(), see http://docstore.mik.ua/orelly/linux/cgi/ch17_01.htm#ch17-2-fm2xml.
- Do not load Safe by default in Bugzilla::Install::Util; this is only useful for checksetup.pl.
- Remove a useless call to IO::File in Bugzilla::Install::Localconfig; it's unused.
Some profiling:

before: 928ms, executing 112202 statements and 45012 subroutine calls

after:  728ms, executing  83528 statements and 36012 subroutine calls
Attached patch patch, v1Splinter Review
In comment 0, I forgot to also mention ExtUtils::MM which is very slow and is only useful in bin_loc().

The profiling I did in comment 1 is with this patch and the one for DateTime.
Assignee: general → LpSolit
Status: NEW → ASSIGNED
Attachment #568839 - Flags: review?(mkanat)
Comment on attachment 568839 [details] [diff] [review]
patch, v1

Review of attachment 568839 [details] [diff] [review]:
-----------------------------------------------------------------

Sweet! Sounds sensible and looks good to me! :-) Few things to fix on checkin:

::: Bugzilla/Install/Util.pm
@@ +56,4 @@
>  
>  sub bin_loc {
>      my ($bin, $path) = @_;
> +    require ExtUtils::MM;

Add a comment here about why this is a require instead of a "use" at the top.

@@ +540,4 @@
>  # Used by install_string
>  sub _get_string_from_file {
>      my ($string_id, $file) = @_;
> +    require Safe;

And here too.
Attachment #568839 - Flags: review?(mkanat) → review+
Flags: approval+
Target Milestone: --- → Bugzilla 5.0
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/
modified Bugzilla/RNG.pm
modified Bugzilla/Install/Localconfig.pm
modified Bugzilla/Install/Util.pm
Committed revision 7991.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Summary: Various load improvements → Only load some external modules when needed, to improve the load time of pages
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: