[ 
https://issues.apache.org/jira/browse/PDFBOX-1457?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Adrian Nistor updated PDFBOX-1457:
----------------------------------

    Description: 
The problem appears in revision 1414788.  I attached a four-line patch
that fixes it.  This problem and the attached patch are similar the
previously fixed PDFBOX-1447 and its patch.

In method "TrailerValidationProcess.compareIds", the loop over
"af.toList()" (outer loop) should break immediately after "isEqual"
becomes "false", because "isEqual = isEqual && oneIsEquals;" can never
become "true" again.

The loop over "al.toList()" (inner loop) should break immediately
after "oneIsEquals" is set to "true".  All the iterations after
"oneIsEquals" is set to "true" do not perform any useful work because
the "if" statement depends on "!oneIsEquals".

  was:
The problem appears in revision 1414788.  I attached a four-line patch
that fixes it.

In method "TrailerValidationProcess.compareIds", the loop over
"af.toList()" (outer loop) should break immediately after "isEqual"
becomes "false", because "isEqual = isEqual && oneIsEquals;" can never
become "true" again.

The loop over "al.toList()" (inner loop) should break immediately
after "oneIsEquals" is set to "true".  All the iterations after
"oneIsEquals" is set to "true" do not perform any useful work because
the "if" statement depends on "!oneIsEquals".

    
> wasted work in TrailerValidationProcess.compareIds()
> ----------------------------------------------------
>
>                 Key: PDFBOX-1457
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1457
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: Adrian Nistor
>              Labels: patch, performance
>         Attachments: patch.diff
>
>
> The problem appears in revision 1414788.  I attached a four-line patch
> that fixes it.  This problem and the attached patch are similar the
> previously fixed PDFBOX-1447 and its patch.
> In method "TrailerValidationProcess.compareIds", the loop over
> "af.toList()" (outer loop) should break immediately after "isEqual"
> becomes "false", because "isEqual = isEqual && oneIsEquals;" can never
> become "true" again.
> The loop over "al.toList()" (inner loop) should break immediately
> after "oneIsEquals" is set to "true".  All the iterations after
> "oneIsEquals" is set to "true" do not perform any useful work because
> the "if" statement depends on "!oneIsEquals".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to