perf: hand out the cached dataset on an empty search

Merged
FU
16d ago
+53-33

clearing a search reuses the sorted order already worked out instead of rechecking every row


Summary by cubic

Clearing a search now reuses the cached dataset instead of recopying every row, so the sort cache can skip its subset walk on an empty term.

  • getCities and getFilms now return the frozen cached array for the empty search term instead of a copy.
  • loadEnvelope freezes the cached array, since callers now share it and a mutation would reorder every later caller's rows.
  • Public result types are now readonly to reflect that callers don't own a mutable array.