GNOME Bugzilla – Bug 422939
garray.c can use memset in stead of looping for g_ptr_array_set_size
Last modified: 2018-05-24 11:00:29 UTC
GPtrArray's g_ptr_array_set_size can actually use memset as glib for all its platforms does use bitwize zeros for NULL. If not this should be detectable using a preprocessor thingy. I'll attach a proposal
Created attachment 85308 [details] [review] Proposal
The NULL == 0 assumption is embedded pretty deep in all of glib. I don't think the preprocessor check there is necessary. Do you see any measurable difference due to using memset() here ?
That is, afaik, going to depend on the architecture Matthias. I can imagine that a memset can be implemented faster than a loop on certain architectures.
Right. I'm just curious if you have a concrete reason for this optimization, or if it is "just because".
I noticed it while doing some performance measuring for tinymail. Nothing special, so it's mostly a "just because" indeed.
Ping, what is the decision on this one? (cleaning up my bugs)
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/87.