Zhang Di created COMPRESS-702:
---------------------------------

             Summary: performance issue found when using 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


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)

Reply via email to