The library mode was slow due to use of item.formatted(), which
runs multiple database queries per item. The --include-keys option
didn't help because it filtered the after the queries had already
happened.
This commit reworks filtering so that we only query the fields
that the user requests. In many cases this can dramatically speed up
execution.
Before:
> /usr/bin/time beet export -l Bob Dylan > /dev/null
13.42user 21.56system 0:35.71elapsed 97%CPU (0avgtext+0avgdata 52396maxresident)k
> /usr/bin/time beet export -l -i artist,title,path Bob Dylan > /dev/null
13.25user 21.17system 0:35.14elapsed 97%CPU (0avgtext+0avgdata 52112maxresident)k
After:
> /usr/bin/time beet export -l Bob Dylan > /dev/null
1.46user 0.09system 0:01.60elapsed 97%CPU (0avgtext+0avgdata 51188maxresident)k
> /usr/bin/time beet export -l -i artist,title,path Bob Dylan > /dev/null
0.50user 0.07system 0:00.58elapsed 97%CPU (0avgtext+0avgdata 50632maxresident)k
This adds support for the JSON Lines format as documented at
https://jsonlines.org/.
In this mode the data is output incrementally, whereas the other
modes load every item into memory and don't produce output until
the end.