summaryrefslogtreecommitdiff
path: root/cache
diff options
context:
space:
mode:
authorewy <ewy0@protonmail.com>2026-05-02 19:42:05 +0200
committerewy <ewy0@protonmail.com>2026-05-02 19:42:05 +0200
commit81235da8faa7a2cfee4ed93fe301cd4e21529b70 (patch)
tree549a65ffe6d7ef311f80ca71587d94670bb6bd59 /cache
parentb84ea05c63294cd2c3c5a9329c55e5ed5617d2f7 (diff)
do not save if not necessary
noticed terrible performance in hyperfine traced back to hundreds of unnecessary saves
Diffstat (limited to 'cache')
-rw-r--r--cache/cache.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/cache/cache.go b/cache/cache.go
index 9af25a5..b4cd989 100644
--- a/cache/cache.go
+++ b/cache/cache.go
@@ -9,6 +9,7 @@ import (
"io/fs"
"os"
"path"
+ "slices"
"strings"
)
@@ -138,6 +139,9 @@ func Insert(in *model.State) error {
}
insert := New(in)
result := loaded.Merge(insert)
+ if slices.Equal(loaded.Entries, result.Entries) {
+ return nil
+ }
return SaveFile(Path, result)
}