Search is very allocation heavy
Started up a fresh GNOME OS (Nightly) instance on a laptop and upon entering the overview typed a couple characters and things were quite slow.
Wrote some new tooling for Sysprof to dive in a bit and see why. gnome-clocks
is the offending binary but a majority of the time is in libgweather. Here is a breakdown of allocations for about 2 seconds of runtime.
Nearly 250 MB of allocations to service a couple keypresses is likely a bit higher than we would anticipate, especially since the search data is itself within mmap'able GVariant-serialized files with structures compiled with gvariant-schema-compiler
.
Here is a bit of the top-offenders breakdown.
240.2 MB : foreach_city.constprop.0
71.5 MB : gweather_location_next_child
68.5 MB : call_in_idle_cb
68.0 MB : clocks_search_provider_deserialize_location
67.9 MB : gweather_location_deserialize
67.9 MB : gweather_location_common_deserialize
67.9 MB : gweather_location_find_nearest_city
66.3 MB : _dbus_clocks_search_provider_get_subsearch_result_set
66.1 MB : clocks_search_provider_get_subsearch_result_set_co.isra.0
61.3 MB : g_object_new
61.2 MB : g_object_new_internal.part.0
60.9 MB : g_object_new_with_properties
60.9 MB : g_type_create_instance
56.9 MB : location_ref_for_idx
39.3 MB : clocks_search_provider_search_locations_recurse_co.isra.0
17.4 MB : g_object_unref
16.5 MB : g_object_notify_queue_freeze
11.0 MB : g_data_set_internal
7.1 MB : clocks_search_provider_search_locations_recurse
3.8 MB : subdivide_infos
3.2 MB : clocks_search_provider_location_matches
2.1 MB : _dbus_clocks_search_provider_get_result_metas
2.1 MB : clocks_search_provider_get_result_metas
2.0 MB : g_source_new
2.0 MB : g_idle_source_new
1.9 MB : g_string_sized_new
1.9 MB : g_utf8_casefold
1.6 MB : g_string_expand
1.3 MB : g_source_destroy_internal
1.3 MB : g_source_callback_unref
1.0 MB : clocks_search_provider_search_locations_co.isra.0