Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
d34b096c
You need to sign in or sign up before continuing.
Commit
d34b096c
authored
Mar 13, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 552168: Speed up comment display by pre-loading all Bugzilla::User
objects for the comment authors, for the whole list, all at once. r=LpSolit, a=LpSolit
parent
217beee4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
Bug.pm
Bugzilla/Bug.pm
+1
-0
Comment.pm
Bugzilla/Comment.pm
+13
-0
No files found.
Bugzilla/Bug.pm
View file @
d34b096c
...
@@ -2719,6 +2719,7 @@ sub comments {
...
@@ -2719,6 +2719,7 @@ sub comments {
$comment
->
{
count
}
=
$count
++
;
$comment
->
{
count
}
=
$count
++
;
$comment
->
{
bug
}
=
$self
;
$comment
->
{
bug
}
=
$self
;
}
}
Bugzilla::
Comment
->
preload
(
$self
->
{
'comments'
});
}
}
my
@comments
=
@
{
$self
->
{
'comments'
}
};
my
@comments
=
@
{
$self
->
{
'comments'
}
};
...
...
Bugzilla/Comment.pm
View file @
d34b096c
...
@@ -27,6 +27,7 @@ use base qw(Bugzilla::Object);
...
@@ -27,6 +27,7 @@ use base qw(Bugzilla::Object);
use
Bugzilla::
Attachment
;
use
Bugzilla::
Attachment
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Error
;
use
Bugzilla::
Error
;
use
Bugzilla::
User
;
use
Bugzilla::
Util
;
use
Bugzilla::
Util
;
###############################
###############################
...
@@ -74,6 +75,18 @@ sub update {
...
@@ -74,6 +75,18 @@ sub update {
return
$changes
;
return
$changes
;
}
}
# Speeds up displays of comment lists by loading all ->author objects
# at once for a whole list.
sub
preload
{
my
(
$class
,
$comments
)
=
@_
;
my
%
user_ids
=
map
{
$_
->
{
who
}
=>
1
}
@$comments
;
my
$users
=
Bugzilla::
User
->
new_from_list
([
keys
%
user_ids
]);
my
%
user_map
=
map
{
$_
->
id
=>
$_
}
@$users
;
foreach
my
$comment
(
@$comments
)
{
$comment
->
{
author
}
=
$user_map
{
$comment
->
{
who
}};
}
}
###############################
###############################
#### Accessors ######
#### Accessors ######
###############################
###############################
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment