jack-cli-cd-ripper / jack

Jack command-line CD ripper
GNU General Public License v2.0
14 stars 5 forks source link

Reading the TOC of a disc can be slow #48

Closed pimzand closed 2 years ago

pimzand commented 2 years ago

Reading the TOC of a disc can be very slow, especially when extracting MCN and ISRC, which is done by default.

There are a number of strategies that could improve the speed, preferably without disabling MCN and ISRC extraction.

pimzand commented 2 years ago

Debugging discid.py shows:

discid and libdiscid do not expose read_sparse(). It appears they call read_sparse() automatically, and fall back to read() if read_sparse() is not available.

pimzand commented 2 years ago

Oviously, we should reduce the number of times jack reads the toc. The first read, used to search an existing jack.toc, should never use the MCN or ISRC features. The second read, used to create the jack.toc, should use the MCN and ISRC features, if the user hasn't disabled it. The third, per-track read should be completely avoided.

pimzand commented 2 years ago

For now, the quick and dirty approach was to cache the results of jack.functions.gettoc, so we only call libdiscid.read() once. This still leaves some room for improvement, as searching for existing jack.toc files still reads the disc with MCN and ISRC features enabled.

But already, there's a big improvement while keeping MCN and ISRC features enabled for future use.

pimzand commented 2 years ago

works quite well, closing