Skip to content
  • Niels De Graef's avatar
    persona: Don't use string.replace · 2a0ac05e
    Niels De Graef authored
    Although it's supposedly part of `glib-2.0.vapi`, `string.replace` is
    _not_ a function implemented by GLib. Worse, what it does is to create
    and compile a `GRegex`, which then gets used to do the substitution.
    
    Since we call `Persona.build_uid()` for each persona, and then even 3
    times in a row, we create an amount of unnecessary temporary
    allocations that linearly increases with the amount of contacts.
    
    To mitigate this, use a `GString` (aka `GLib.StringBuilder`) and try to
    allocate the right amount from the start.
    2a0ac05e