1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-16 18:01:37 +00:00

refactor(model): remove some indirection

For small fixed-size structures, it's better to use a slice of values, instead
of a slice of pointers to values: they're stored contiguously and thus can be
iterated on quickly by the CPU, and it does remove an indirection per object
every time the GC kicks in.
This commit is contained in:
Julien Voisin 2025-08-13 04:46:14 +02:00 committed by GitHub
parent 1e6d227e40
commit 8bca777a6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 12 additions and 9 deletions

View file

@ -8,6 +8,8 @@ import (
)
// APIKey represents an application API key.
// We need to use a pointer for LastUsedAt,
// as the value obtained from the database might sometimes be nil.
type APIKey struct {
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
@ -18,7 +20,7 @@ type APIKey struct {
}
// APIKeys represents a collection of API Key.
type APIKeys []*APIKey
type APIKeys []APIKey
// APIKeyCreationRequest represents the request to create a new API Key.
type APIKeyCreationRequest struct {