HaxeFoundation / HaxeFoundation/haxe
InflateImpl Slow on Python
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
I've noticed that the haxe.zip.InflateImpl class seems extremely slow when compiled for the Python target compared against the same code compiled for say Java or C++. I've written a [small test class](https://github.com/HaxeFoundation/haxe/files/3336904/ZipTest.txt) which can unzip a file to a directory - here are the times that I'm getting against a few targets for the [Haxe 4.0.0-rc2 windows](https://haxe.org/download/file/4.0.0-rc.2/haxe-4.0.0-rc.2-win64.zip/) zip file (8.37 MB):
```
> haxe --python test.py -m ZipTest.hx
> python test.py haxe-4.0.0-rc.2-win64.zip out
elapsed: 106.2366874217987
> haxe --java test -m ZipTest.hx
> java -jar test\ZipTest.jar haxe-4.0.0-rc.2-win64.zip out\
ZipTest.hx:70: elapsed: 10.764000177383423
> haxe --cpp test -m ZipTest.hx
> test\ZipTest.exe haxe-4.0.0-rc.2-win64.zip out\
ZipTest.hx:70: elapsed: 13.8790016174316
```
These times seem roughly consistent to me on my machine. From what I can tell, it's the `if(_entry.compressed)` block that is taking the time, specifically the `inf.readBytes` call. I might expect python to be a bit slower, but I wasn't expecting that much of a difference.
While the above tests were done with 4.0.0-rc2, I did notice the same issue with 4.0.0.-rc3.
Contributor guide
Assessment
This issue has not been assessed yet.