perf(config): hash-based baseline fingerprint dedup

ober

28c72fcc17650c6ab22bc80a028a4d4e3f28ab13

diff --git a/gitsafe/config.ss b/gitsafe/config.ss
index 9042314..0f1acf7 100644
--- a/gitsafe/config.ss
+++ b/gitsafe/config.ss
@@ -242,6 +242,16 @@
           (apply append groups)))
       '()))
 
+  (def (unique-fingerprints fps)
+    (let ([seen (make-hash-table)])
+      (let loop ([xs fps] [acc '()])
+        (cond
+          [(null? xs) (reverse acc)]
+          [(hash-key? seen (car xs)) (loop (cdr xs) acc)]
+          [else
+           (hash-put! seen (car xs) #t)
+           (loop (cdr xs) (cons (car xs) acc))]))))
+
   (def (load-baseline-fingerprints path)
     (if (or (not path) (not (file-exists? path)))
       '()
@@ -249,7 +259,7 @@
         (let* ([obj (string->json-object (read-file-string path))]
                [fps (append (native-report-fingerprints obj)
                             (sarif-report-fingerprints obj))])
-          (unique fps))
+          (unique-fingerprints fps))
         (catch (e)
           (displayln "gitsafe: warning: could not parse baseline report, ignoring it")
           '()))))