Closed
Bug 344298
Opened 19 years ago
Closed 19 years ago
importxml.pl performance problem
Categories
(Bugzilla :: Bug Import/Export & Moving, defect)
Tracking
()
RESOLVED
FIXED
Bugzilla 2.22
People
(Reporter: vrb, Assigned: vrb)
References
Details
Attachments
(1 file, 1 obsolete file)
2.26 KB,
patch
|
gregaryh
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4
The importxml.pl script takes an extremely long time (half an hour or more) to process an XML file if it contains large (several MB) attachments.
I will attach a workaround for this problem.
Reproducible: Always
Steps to Reproduce:
1.Use importxml.pl to import a file that contains a 5MB attachment.
2.
3.
Actual Results:
It takes over half an hour on a reasonably modern Pentium 4.
Expected Results:
It should take less time. :-)
Assignee | ||
Comment 1•19 years ago
|
||
Attachment #228864 -
Flags: review?(ghendricks)
Assignee | ||
Comment 2•19 years ago
|
||
With this patch, importxml.pl can process a file with five 5MB attachments (total of 25MB) in 4.5 seconds on a 1400MHz Pentium III.
Without the patch, I stopped the stopwatch after 45 minutes. :-)
Comment 3•19 years ago
|
||
Comment on attachment 228864 [details] [diff] [review]
workaround for performance problem
>+ elsif ($encoding =~ /filename/) {
>+ # read the attachment file
>+ Error("attach_path is required", undef) unless ($attach_path);
>+ my $attach_filename = $attach_path . "/" . $attach->field('data');
What happens if I am running this on Windows?
>+ Error("cannot open $attach_filename", undef) unless
>+ open(ATTACH_FH, $attach_filename);
Nit: I think this would be more readable (an more standard) as open(...) or Error()
>+ undef $/;
>+ $attachment{'data'} = <ATTACH_FH>;
>+ close ATTACH_FH;
>+ $/ = "\n";
Perl Best Practices suggests you use $variable = do { local $/; <HANDLE> };
This ensures that $/ does not get reset globally. Also, how do you know that
$/ was \n in the first place? Again, what if this was on Windows?
Attachment #228864 -
Flags: review?(ghendricks) → review-
Assignee | ||
Comment 4•19 years ago
|
||
Good suggestions -- thanks.
Attachment #228864 -
Attachment is obsolete: true
Attachment #228876 -
Flags: review?(ghendricks)
Comment 5•19 years ago
|
||
FWIW: even better is to use IO::File and use the methods for slurping in the whole file.
Also, somebody should confirm this bug if it's a confirmed problem.
Assignee: import-export → vrb
OS: Linux → All
Hardware: PC → All
Summary: workaround for importxml.pl performance problem → importxml.pl performance problem
Comment 6•19 years ago
|
||
Both vrb and Myself can definitely confirm this as a legitamate problem.
OS: All → Linux
Hardware: All → PC
Updated•19 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Updated•19 years ago
|
Status: NEW → ASSIGNED
OS: Linux → All
Hardware: PC → All
Comment 7•19 years ago
|
||
Comment on attachment 228876 [details] [diff] [review]
take 2
Works nicely.
Attachment #228876 -
Flags: review?(ghendricks) → review+
Updated•19 years ago
|
Flags: approval?
Updated•19 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Updated•19 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Updated•19 years ago
|
Status: REOPENED → ASSIGNED
Updated•19 years ago
|
Flags: approval? → approval+
![]() |
||
Updated•19 years ago
|
Flags: approval2.22?
Target Milestone: --- → Bugzilla 2.22
Version: unspecified → 2.22
Updated•19 years ago
|
Flags: approval2.22? → approval2.22+
![]() |
||
Comment 8•19 years ago
|
||
tip:
Checking in importxml.pl;
/cvsroot/mozilla/webtools/bugzilla/importxml.pl,v <-- importxml.pl
new revision: 1.62; previous revision: 1.61
done
2.22:
Checking in importxml.pl;
/cvsroot/mozilla/webtools/bugzilla/importxml.pl,v <-- importxml.pl
new revision: 1.47.2.5; previous revision: 1.47.2.4
done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago → 19 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•