You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Zhang Di (Jira)" <ji...@apache.org> on 2025/08/02 02:37:00 UTC

[jira] [Commented] (COMPRESS-702) Performance issue in SevenZFile

    [ https://issues.apache.org/jira/browse/COMPRESS-702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18011523#comment-18011523 ] 

Zhang Di commented on COMPRESS-702:
-----------------------------------

Hi Gary

OK,thank you!

> Performance issue in SevenZFile
> -------------------------------
>
>                 Key: COMPRESS-702
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-702
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Archivers, Compressors
>    Affects Versions: 1.27.1
>            Reporter: Zhang Di
>            Priority: Major
>             Fix For: 1.28.1
>
>
> I found a performance issue after upgrading commons-compress from version 1.26.1 to 1.27.1.
> Here are some details:
> {*}Issue Method{*}:
> SevenZFile.java
> public InputStream getInputStream(final SevenZArchiveEntry entry)throws IOException
> {*}Test Case{*}:
> ```java
> public static void main(String[] args) {
>     try(SevenZFile SevenZFile = new SevenZFile(new File("D:\\xxx.7z"))) {
>         byte[] buffer = new byte[8192];
>         SevenZArchiveEntry entry;
>         while((entry = SevenZFile.getNextEntry())!=null){
>             if(entry.isDirectory()){
>                 continue;
>             }
>             InputStream inputStream = SevenZFile.getInputStream(entry);
>             File outputFile = new File("D:\\7ztest\\" + entry.getName());
>             if(!outputFile.getParentFile().exists()){
>                 outputFile.getParentFile().mkdirs();
>             }
>             try(FileOutputStream fos = new FileOutputStream(outputFile)){
>                 while(inputStream.read(buffer>0)){
>                     fos.write(buffer);
>                 }
>             }catch(FileNotFoundException e){
>                 e.printStackTrace();
>             }catch(IOException e){
>                 e.printStackTrace();
>             }
>         }
>     } catch (Exception e) {
>     }
> }
> ```
> I tested this case on 1.26.1 and it cost about 900 ms , while on the other hand it cost 120,000 ms on 1.27.1. I am trying to figure out the cause, but still can not find a clue.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)