AppImageCommunity / zsync2

Rewrite of https://github.com/AppImage/zsync-curl, using modern C++, providing both a library and standalone tools.
Other
132 stars 25 forks source link

zsyncmake2 is really slow (compared to zsyncmake) on a large file #69

Open vebjornjr opened 1 year ago

vebjornjr commented 1 year ago

Hello.

Thank you for this rewrite of zsync.

I have a large file of size 1.2GB which zsyncmake2 performs much worse than original zsyncmake on. Is this expected?

$ time zsyncmake2 FILE.tar
zsync2 version 2.0.0-alpha-1 (commit ), build <local dev build> built on 2023-03-08 11:03:16 UTC
No URL given, so I am including a relative URL in the .zsync file - you must keep the file being served and the .zsync in the same public directory. Use -u eikefet.tar to get this same result without this warning.
Warning: the given URL is relative. Please make sure the files are placed correctly on the server, otherwise zsync2 won't be able to resolve the path to the target file, requiring the user to specify this URL on the command line (using the -u flag).

real    2m56.362s
user    2m53.642s
sys     0m0.933s
$ time zsyncmake FILE.tar
No URL given, so I am including a relative URL in the .zsync file - you must keep the file being served and the .zsync in the same public directory. Use -u eikefet.tar to get this same result without this warning.

real    0m7,553s
user    0m6,375s
sys     0m1,151s

However, zsync2 is faster when redownloading the file.

$ time zsync2 URL/FILE.tar.zsync
zsync2 version 2.0.0-alpha-1 (commit ), build <local dev build> built on 2023-03-08 11:03:16 UTC
Checking for changes...
Using CA bundle found on system: /etc/ssl/certs/ca-certificates.crt
No changes detected, file is up to date.

real    0m4.886s
user    0m3.283s
sys     0m1.408s
$ time zsync URL/FILE.tar.zsync
Target FILE.tar
reading seed file FILE.tar: *************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************Read FILE.tar. Target 100.0% complete.      *************************************************************************************************************
verifying download...checksum matches OK
used 1261629440 local, fetched 0

real    0m24.847s
user    0m7.243s
sys     0m6.691s
TheAssassin commented 1 year ago

zsyncmake2 wasn't really developed with performance in mind. It does consume an entire CPU despite being relatively slow. I'm sure it could be improved further.

TheAssassin commented 1 year ago

I just saw a slowdown by a factor of 100. That's clearly not normal and not intentional.