mirror of
https://github.com/miniflux/v2.git
synced 2025-09-15 18:57:04 +00:00
perf: cache the format of feeds
Detecting the format of a feed accounts for up to 30% of the time spent in `parser.ParseFeed`. Cache the value once detected, as it'll never change.
This commit is contained in:
parent
e342a4f143
commit
c4a2afb7b7
12 changed files with 58 additions and 11 deletions
|
@ -25,6 +25,9 @@ func NewAtom03Adapter(atomFeed *Atom03Feed) *Atom03Adapter {
|
|||
func (a *Atom03Adapter) BuildFeed(baseURL string) *model.Feed {
|
||||
feed := new(model.Feed)
|
||||
|
||||
feed.Format = "atom"
|
||||
feed.FormatVersion = "0.3"
|
||||
|
||||
// Populate the feed URL.
|
||||
feedURL := a.atomFeed.Links.firstLinkWithRelation("self")
|
||||
if feedURL != "" {
|
||||
|
|
|
@ -29,6 +29,9 @@ func NewAtom10Adapter(atomFeed *Atom10Feed) *Atom10Adapter {
|
|||
func (a *Atom10Adapter) BuildFeed(baseURL string) *model.Feed {
|
||||
feed := new(model.Feed)
|
||||
|
||||
feed.Format = "atom"
|
||||
feed.FormatVersion = "10"
|
||||
|
||||
// Populate the feed URL.
|
||||
feedURL := a.atomFeed.Links.firstLinkWithRelation("self")
|
||||
if feedURL != "" {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue