Reorder the fields of the Entry struct to save some memory
Given that there is always a ton of `Entry` floating around, reordering its field to take less space is a quick/simple way to reduce miniflux' memory consumption. I kept the `ID` field as the first member, as I think it's the most important one, and moving it somewhere else would drown it in other fields. Anyway, this still provides a reduction of 32 bytes per Entry: ```console $ fieldalignment ./client/model.go 2>&1 | grep 203 ~/v2/client/model.go:203:12: struct with 280 pointer bytes could be 240 $ fieldalignment ./client/model.go 2>&1 | grep 203 ~/v2/client/model.go:203:12: struct with 248 pointer bytes could be 240 $ ``` The same optimisation pass could be applied to other structs, but since they aren't present in obviously great numbers during miniflux' life cycle, it would likely require some profiling to see if it's worth doing it.
This commit is contained in:
parent
c544dadd55
commit
2be5051b19
1 changed files with 10 additions and 10 deletions
|
@ -202,24 +202,24 @@ type Feeds []*Feed
|
||||||
// Entry represents a subscription item in the system.
|
// Entry represents a subscription item in the system.
|
||||||
type Entry struct {
|
type Entry struct {
|
||||||
ID int64 `json:"id"`
|
ID int64 `json:"id"`
|
||||||
UserID int64 `json:"user_id"`
|
Date time.Time `json:"published_at"`
|
||||||
FeedID int64 `json:"feed_id"`
|
ChangedAt time.Time `json:"changed_at"`
|
||||||
Status string `json:"status"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
Feed *Feed `json:"feed,omitempty"`
|
||||||
Hash string `json:"hash"`
|
Hash string `json:"hash"`
|
||||||
Title string `json:"title"`
|
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
CommentsURL string `json:"comments_url"`
|
CommentsURL string `json:"comments_url"`
|
||||||
Date time.Time `json:"published_at"`
|
Title string `json:"title"`
|
||||||
CreatedAt time.Time `json:"created_at"`
|
Status string `json:"status"`
|
||||||
ChangedAt time.Time `json:"changed_at"`
|
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
Author string `json:"author"`
|
Author string `json:"author"`
|
||||||
ShareCode string `json:"share_code"`
|
ShareCode string `json:"share_code"`
|
||||||
Starred bool `json:"starred"`
|
|
||||||
ReadingTime int `json:"reading_time"`
|
|
||||||
Enclosures Enclosures `json:"enclosures,omitempty"`
|
Enclosures Enclosures `json:"enclosures,omitempty"`
|
||||||
Feed *Feed `json:"feed,omitempty"`
|
|
||||||
Tags []string `json:"tags"`
|
Tags []string `json:"tags"`
|
||||||
|
ReadingTime int `json:"reading_time"`
|
||||||
|
UserID int64 `json:"user_id"`
|
||||||
|
FeedID int64 `json:"feed_id"`
|
||||||
|
Starred bool `json:"starred"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// EntryModificationRequest represents a request to modify an entry.
|
// EntryModificationRequest represents a request to modify an entry.
|
||||||
|
|
Loading…
Reference in a new issue