Repository navigation
[pull] main from miniflux:main - #297
Merged
Merged
Conversation
Obtaining the amount of unread entries, errored feeds and if the user has integrations enabled can be done in a single query, instead of doing it one by one. This should reduce the amount of queries from 3 or 2 to 1, depending on the page. This commit is touching a significant amount of files, and the search-and-replace, while done with love and care, would benefit from a thorough review, to ensure that nothing was subtly broken.
Extend OPML export to include Miniflux-specific feed settings as custom attributes on each outline element (scraper rules, rewrite rules, URL rewrite rules, blocklist/keeplist rules, user agent, cookie, proxy URL, and various boolean flags). On import, these attributes are applied when creating new feeds, allowing a Miniflux OPML export to serve as a full backup and restore mechanism for feed configuration. Existing feeds are not modified to preserve the original import semantics.
On the main page (showing ~every unread feed item), every item uses at least 4 icons. For 100 unread items, that's 400 icons, meaning that the `icon` func is called 400 times. On my local microbenchmark, using `fmt.Sprintf` uses one dynamic allocation and takes ~275ns. Using concatenation in a dedicated function (that gets inlined) doesn't allocate any memory, and takes ~2.1ns. This thus saves 400 short-lived allocations and reduces the execution time by a factor of 100.
Previously, every allowed attribute had to allocate memory for a slice, concatenated in `key=…`, and a final strings.Join call. Instead of doing all of this, a single string.Builder is used, with two simple local functions. It doesn't significantly complexify the code, while improving the performances. Now, I know that this isn't really a bottleneck in miniflux, but the improvement is around 50% for the wikipedia/github benchmark (BenchmarkSanitize), so I think it's worth it, given that the sanitizeAttributes function is call for every attribute a feed items. Before: ``` goos: linux goarch: arm64 pkg: miniflux.app/v2/internal/reader/sanitizer BenchmarkSanitizeImageHeavyNoQuery-8 6326 567676 ns/op 78305 B/op 918 allocs/op BenchmarkSanitizeImageHeavyWithQuery-8 4186 1028312 ns/op 124353 B/op 1366 allocs/op BenchmarkSanitize-8 50 21440566 ns/op PASS ok miniflux.app/v2/internal/reader/sanitizer 9.039s ``` After: ``` goos: linux goarch: arm64 pkg: miniflux.app/v2/internal/reader/sanitizer BenchmarkSanitizeImageHeavyNoQuery-8 7512 530973 ns/op 73186 B/op 790 allocs/op BenchmarkSanitizeImageHeavyWithQuery-8 1173 1023078 ns/op 118209 B/op 1238 allocs/op BenchmarkSanitize-8 92 13265599 ns/op PASS ok miniflux.app/v2/internal/reader/sanitizer 6.553s ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )