beets/beetsplug
Sam Thursfield 2fa3717731 Optimise FormattedMapping when querying a specific set of fields
This changes greatly improves the speed of `beet export` and `beet info`
when the `--include-keys` option is used. It also removes the globbing
feature of `--include-keys` that was added in #1295. (See #3762 for
discussion).

Listing all fields for an item requires querying the database to find
any flex attributes. This is slow when done for every item being
exported. We already have a way for the user to specify a fixed set
of keys, but we previously queried everything and filtered it afterwards.
The new approach is more efficient.

Code that iterates through all fields now have to handle invalid field
names. The export and info plugins output invalid fields as None.

Timings before:

    > /usr/bin/time beet export -i title,path,artist -l  Bob Dylan
    13.26user 20.22system 0:34.01elapsed 98%CPU (0avgtext+0avgdata 52544maxresident)k

    > /usr/bin/time beet export -l  Bob Dylan
    12.93user 20.15system 0:33.58elapsed 98%CPU (0avgtext+0avgdata 53632maxresident)k

Timings after:

    > /usr/bin/time beet export -l  Bob Dylan
    13.33user 20.17system 0:34.02elapsed 98%CPU (0avgtext+0avgdata 53500maxresident)k

    > /usr/bin/time beet export -i title,path,artist -l  Bob Dylan
    0.49user 0.07system 0:00.56elapsed 98%CPU (0avgtext+0avgdata 50496maxresident)k

Notice the dramatic speedup in the last example!
2021-05-01 23:41:09 +02:00
..
bpd chore: refactor code quality issues 2021-03-11 08:45:42 +05:30
lastgenre lastgenre: Make TitleCasing optional 2020-12-15 23:37:16 +00:00
metasync feat: added github actions 2020-05-25 19:35:15 -04:00
web Fixed bug where readonly value was not being read from config file. 2021-03-12 17:58:35 +00:00
__init__.py Standardize __future__ imports without parentheses 2016-02-28 15:03:51 -08:00
absubmit.py util.command_output: return stderr, too 2019-07-14 18:32:59 +02:00
acousticbrainz.py Issue #2860 Fetch more acousticbrainz fields 2019-07-23 20:25:26 -04:00
aura.py AURA: Small updates to docs and set server version 2021-03-07 18:24:57 +00:00
badfiles.py Use simpler approach of asserting that at most one handler of import_task_before_choice returns an action. 2021-03-28 16:53:01 -05:00
bareasc.py Remove unnecessary call to format. 2021-03-16 22:36:42 +00:00
beatport.py add the extra_tags option to all required plugins 2020-03-28 17:36:02 +10:00
bench.py Allow multiple MB ids to be passed to the importer 2016-01-19 21:43:32 +01:00
bpm.py Merge pull request #1992 from jackwilsdon/add-write-bpm 2017-01-01 23:09:41 -05:00
bpsync.py Improve documentation 2019-10-05 15:07:20 -07:00
bucket.py Resolve W605: invalid escape sequence 2018-08-13 10:41:01 -04:00
chroma.py Fixes #3834: 2021-01-19 22:05:34 +00:00
convert.py Merge branch 'master' into pr/item-album-fallback 2021-03-07 09:20:50 -05:00
deezer.py Guard against "empty" albums 2019-10-05 23:12:53 -07:00
discogs.py Remove ascii encoding step now library is fixed 2021-03-17 09:06:35 +00:00
duplicates.py util.command_output: return stderr, too 2019-07-14 18:32:59 +02:00
edit.py Replace more instances of unsafe calls to yaml.load 2019-04-20 01:14:15 +02:00
embedart.py Default quality to 0 which means don't specify 2020-02-18 14:50:57 -05:00
embyupdate.py A little fiddling with embyupdate 2017-01-07 17:07:01 -05:00
export.py Optimise FormattedMapping when querying a specific set of fields 2021-05-01 23:41:09 +02:00
fetchart.py Merge pull request #3560 from davidswarbrick/master 2021-03-23 12:15:51 +01:00
filefilter.py Fix incorrect indentation 2019-01-31 00:15:42 +00:00
fish.py chore: refactor code quality issues 2021-03-11 08:45:42 +05:30
freedesktop.py Standardize __future__ imports without parentheses 2016-02-28 15:03:51 -08:00
fromfilename.py Fix "line too long" Travis CI error 2017-12-21 15:18:25 +01:00
ftintitle.py Fix #2817: drop in configuration was ignored 2018-02-23 18:18:32 -05:00
fuzzy.py Use new as_str method 2016-06-25 19:16:14 -07:00
gmusic.py gmusic: Fix compatibility with gmusicapi>=12.0.0 2019-05-18 16:32:56 -04:00
hook.py Switch to using check_call for hooks 2019-10-17 11:00:59 +01:00
ihate.py Standardize __future__ imports without parentheses 2016-02-28 15:03:51 -08:00
importadded.py chore: refactor code quality issues 2021-03-11 08:45:42 +05:30
importfeeds.py Fix importfeeds plugin on Python 3. 2017-08-12 16:45:13 +01:00
info.py Optimise FormattedMapping when querying a specific set of fields 2021-05-01 23:41:09 +02:00
inline.py inline: Fix a ridiculously subtle flexattr bug 2019-06-01 12:28:47 -04:00
ipfs.py Merge pull request #2554 from musoke/python3-plugin-ipfs 2020-07-14 06:58:20 -04:00
keyfinder.py Fix line length 2020-12-07 22:11:08 -05:00
kodiupdate.py Make error handling and logging more detailed 2017-08-20 14:51:03 -07:00
lastimport.py Update a lot of URLs to use HTTPS 2019-06-05 03:11:49 +02:00
loadext.py Add loadext plugin 2019-04-21 15:10:28 +01:00
lyrics.py Review comments 2021-04-11 18:38:01 -05:00
mbcollection.py mbcollection: Make sure missing albums are removed from collections correctly. 2018-02-23 12:34:33 +00:00
mbsubmit.py Update a lot of URLs to use HTTPS 2019-06-05 03:11:49 +02:00
mbsync.py chore: refactor code quality issues 2021-03-11 08:45:42 +05:30
missing.py chore: refactor code quality issues 2021-03-11 08:45:42 +05:30
mpdstats.py Clean up strip_path and logging 2021-02-23 10:40:59 +01:00
mpdupdate.py mpdupdate: use MPD_PORT env variable 2019-04-19 17:35:42 +10:00
parentwork.py small problem with parent composer 2020-08-09 18:56:52 +02:00
permissions.py replace deprecated log.warn() with log.warning() 2016-08-09 00:33:38 -04:00
play.py Add ability for play plugin to emit utf8 BOM 2018-06-08 23:26:48 -06:00
playlist.py un-ignore E221 2020-07-11 18:33:08 -07:00
plexupdate.py Rename use_secure to secure and add to changelog 2020-06-08 20:19:19 -04:00
random.py random: beets.util.random -> beets.random 2019-04-07 18:46:11 +10:00
replaygain.py Merge pull request #3890 from wisp3rwind/pr_rg_import_fixes 2021-03-18 22:42:42 +01:00
rewrite.py Use new as_str method 2016-06-25 19:16:14 -07:00
scrub.py mediafile: import from standalone module 2019-05-29 09:35:14 +10:00
smartplaylist.py fix: revert flake8 change 2020-06-04 02:09:04 -04:00
sonosupdate.py Remove unused import. 2018-04-20 08:25:08 +02:00
spotify.py Integrate MetadataSourcePlugin 2019-09-15 15:59:24 -07:00
subsonicplaylist.py chore: refactor code quality issues 2021-03-11 08:45:42 +05:30
subsonicupdate.py style: whitespace fix, remove unnecessary parenthesis 2021-01-19 19:09:30 +01:00
the.py fix regex, add test and changelog entry 2020-07-30 22:42:31 +02:00
thumbnails.py Fix thumbnail plugin pathlib bug (#3360) 2020-07-15 21:00:50 -05:00
types.py confit: replace with confuse in plugins 2019-06-01 10:03:41 +10:00
unimported.py improvements from review #2 2019-10-15 21:54:35 +02:00
zero.py confit: replace with confuse in plugins 2019-06-01 10:03:41 +10:00