I found interesting function in utils.c: gboolean utils_str_equal(const gchar *a, const gchar *b) { /* (taken from libexo from os-cillation) */ if (a == NULL && b == NULL) return TRUE; else if (a == NULL || b == NULL) return FALSE;
while (*a == *b++) if (*a++ == '\0') return TRUE; return FALSE; } This function is widely used in Geany code. However: - it is not inline so there is no reason to keep this small while loop - it uses own while-loop to compare that is *slow* for big strings - GLib has similar g_strcmp0 function since 2.16 Using while-loop may confuse compiler which knows strcmp and may optimize this std call e.g. for constants. Furthermore strcmp is SSE-accelerated function which compares 128 bits per cycle while this implementstion may compare only 8 bits per cycle. Replace this by inline (g_strcmp0(a, b) == 0). This is much faster and easier to read. -- Best regards, Pavel Roschin aka RPG _______________________________________________ Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel