Search speed optimizations by alexanderadam · Pull Request #2997 · standardnotes/app

It's mostly changing orders and taking things out of the hot path:

  • precomputing the parsed query once and reuse it
  • taking regex constants out of the hotpath
  • first filtering results and only then sorting them
  • caching of the lowercased query string
  • existing the search loop once we know that the result buckets are full

PS: I'm looking for a new adventure in case anybody is looking to hire or work with a PO/PM or Ruby/Rails/Crystal dev