Skip to content
  • Max Gaukler's avatar
    Improve performance by avoiding Glib::ustring · c9ed45da
    Max Gaukler authored
    Using Glib::ustring with ==, <, .compare(), and as map key has unexpected consequences and performance hits: The checking uses g_utf8_collate(), which does locale-aware sorting and therefore takes much longer than std::string which uses something like strcmp().
    
    This patch addresses several bottlenecks (as seen in Callgrind) by
    
    - converting Glib::ustring to std::string
      by applying .raw() before testing for equality
    
    - changing map key types to std::string
    
    and therefore reduces the relative CPU usage of g_utf8_collate() from 4% to <1%. This should translate into ca. 0.2 seconds of startup time reduction out of currently 6 total seconds.
    
    The timing measurement method and technical background are described here: !6311
    c9ed45da