cinsttool opened a new pull request, #188:
URL: https://github.com/apache/pdfbox/pull/188

   Hi,
   
   We find that there exist container inefficiencies in Type1CharString.java, 
COSWriterCompressionPool.java, and ShadedTriangle.java.
   
   In particular, at line 301 of Type1CharString.java, the object `list` copies 
the `numbers` and removes the last two elements for calculation purposes before 
adding the result, which is then returned by the method `handleType1Command`. 
Apart from this scenario, method `handleType1Command` returns 
`Collections.emptyList()`. However, at lines 154 and 155, after the the 
invocation of `handleType1Command`, the `numbers` object is cleared, and the 
`results` object are copied to the `numbers` object using the `addAll` method. 
This process involves redundant copying and clearing operations.
   
   For COSWriterCompressionPool.java, at the line 56, the created `List` object 
`allDirectObjects` is only used for `contains` and `add` operations within the 
`addElements` method. Such usage scenarios are more suitable for a `Set` 
container with lower complexity.
   
   For ShadedTriangle.java, according to the prurpose of method calcDeg, there 
is too expensive to create objects and pass them to a `Set` to obtain the count 
of unique elements and then returning the count.
   
   We discovered the above containers inefficiencies by our tool cinst. The 
patch is submitted. Could you please check and accept it? We have tested the 
patch on our PC. The patched program works well.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to