Closed lemon24 closed 2 weeks ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 95.16%. Comparing base (
97a0c98
) to head (7c57706
). Report is 5 commits behind head on master.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@nobrowser, this exists now (feel free to leave feedback if you want to); I will merge it and make a release in the next days.
@nobrowser, this exists now (feel free to leave feedback if you want to); I will merge it and make a release in the next days.
Thank you, I'm taking a step back and thinking if I should use python for this at all. But looks like this change would indeed be helpful.
Approach described in https://github.com/lemon24/reader/issues/359#issuecomment-2446102455.
Timings below, summary:
Before:
After:
Timings generated with:
```python import timeit from reader import make_reader reader = make_reader('db.sqlite') url = 'https://death.andgravity.com/_feed/index.xml' tags = ".update corp webcomic main".split() def time(stmt, label='', repeat=100): times = timeit.repeat(stmt, repeat=repeat, number=1, globals=globals()) print( f"{label or stmt:24} min {min(times):.6f} avg {sum(times)/len(times):.6f}") print(reader.get_feed_counts().total, 'total feeds') for tag in tags: print(reader.get_feed_counts(tags=[tag]).total, f'feeds tagged {tag!r}') print() def time_get_feeds(tags): time(f"for _ in reader.get_feeds(tags={tags!r}): ...", f"{tags}") print("get_feeds(tags=...)") for tag in tags: time_get_feeds([tag]) time_get_feeds([True]) time_get_feeds([['corp', 'webcomic']]) time_get_feeds([['-webcomic']]) time_get_feeds([['corp'], ['webcomic']]) print() def time_get_feed_counts(tags): time(f"reader.get_feed_counts(tags={tags!r})", f"{tags}") print("get_feed_counts(tags=...)") time_get_feed_counts(['.update']) time_get_feed_counts([True]) time_get_feed_counts([['corp', 'webcomic']]) time_get_feed_counts([['corp'], ['webcomic']]) print() entry_tags = ".comments .readtime".split() print(reader.get_entry_counts().total, 'total entries') for tag in entry_tags: print(reader.get_entry_counts(tags=[tag]).total, f'entries tagged {tag!r}') print() def time_get_entry_counts(tags): time(f"reader.get_entry_counts(tags={tags!r})", f"{tags}", 10) print("get_entry_counts(tags=...)") for tag in entry_tags: time_get_entry_counts([tag]) print() reader.close() ```