Optimize keyword search

Christian Hergert requested to merge wip/chergert/performance into main

This changeset has a bunch of performance fixes to reduce the overhead of interactive search. In particular it:

  • Cuts out hundreds of thousands of strlen() calls per keyword
  • Cuts out hundreds of thousands of memory allocations and ucs4 to utf8 conversions
  • Cuts out hundreds of thousands of calls to g_strstr_len() through it's slow path to strcmp() which can be hoisted/optimized by the compiler
  • Avoids tens of thousands of calls to g_task_return_error_if_cancelled() now that search is generally fast enough to not warrant the function call overhead
  • Inlines hex conversion for comparison avoiding calls to g_strtoul and strspn hundreds of thousands of times.
  • Fixes a memory leak of significant amounts utf8 data
  • Ensures that some conversion functions always leave a \0 terminated string
  • Fixes a potential leak in some public API
  • Reduces GNOME Shell search provider to max 20 results as only 5 are shown

Fixes #130 (closed)

Edited by Christian Hergert

Merge request reports