Kavita icon indicating copy to clipboard operation
Kavita copied to clipboard

Fallback to other locations when ComicInfo.xml not at root of archive

Open tjarls opened this issue 2 years ago • 4 comments

Changed

  • Changed: Try using ComicInfo in other location when not present at its canonical location at the root of the comic archive

tjarls avatar Sep 21 '22 00:09 tjarls

What was the difference in terms of memory and performance btw? Just curious what you saw.

Sorry it was late, and did not report on that. The difference is within the statistical noise, so too small to be conclusive. So typically within 1 us, while the whole operation depends on the size of the archive from around 50 us for the zips from the unit tests to 400 with examples from my libraries. My server, where I ran the tests is unfortunately too busy to be precise enough and in some of my tests the order was sometimes even inverted. One example:

Method Mean Error StdDev
TestGetComicInfo2 53.72 us 0.517 us 0.596 us
TestGetComicInfo 53.14 us 0.470 us 0.523 us

tjarls avatar Sep 21 '22 07:09 tjarls

I have updated the benchmarks to compare cases where

  1. comicInfo is in the correct location. This is slightly faster than with current version.
  2. comicInfo is in duplicated. This would have been the same as 1) but it's slower because the archive is larger
  3. comicInfo is not in root but present in subdir. This should be slightly slower. The size of the archive is the main factor in timings and memory usage. The lookup of the right ComicInfo file, regardless of the scenario, is just too small to have any impact.

tjarls avatar Sep 21 '22 09:09 tjarls

Here's the results. 1) is baseline, 2) is "duplicate" and 3) is "outside_root":

Method Mean Error StdDev Ratio Rank Gen0 Gen1 Gen2 Allocated Alloc Ratio
TestGetComicInfo_baseline 49.72 us 0.437 us 0.503 us 1.00 1 0.4272 0.3662 - 37.2 KB 1.00
TestGetComicInfo_duplicate 52.02 us 0.308 us 0.355 us 1.05 2 0.4272 0.3662 0.0610 38.77 KB 1.04
TestGetComicInfo_outside_root 52.11 us 0.141 us 0.162 us 1.05 2 0.4272 0.3662 0.0610 38.17 KB 1.03

tjarls avatar Sep 21 '22 09:09 tjarls

I have some examples as it also caught me off guard. Let me find them and I'll shoot over via discord.

majora2007 avatar Sep 21 '22 11:09 majora2007