Are GArrays stored in memory contiguously? If so are they cache friendly?
Acessing a GArray element by index with GArray_index()
is O(1)?
Are GArrays stored in memory contiguously? If so are they cache friendly?
Acessing a GArray element by index with GArray_index()
is O(1)?
Yes
struct GArray {
gchar *data;
guint len;
};
The source for g_array_index
#define g_array_index(a,t,i) (((t*) (void *) (a)->data) [(i)])
GArray is really just a refcounted box around a lump of memory with some sugar for working with it
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.