After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 422939 - garray.c can use memset in stead of looping for g_ptr_array_set_size
garray.c can use memset in stead of looping for g_ptr_array_set_size
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: garray
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2007-03-26 09:48 UTC by Philip Van Hoof
Modified: 2018-05-24 11:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposal (616 bytes, patch)
2007-03-26 09:49 UTC, Philip Van Hoof
none Details | Review

Description Philip Van Hoof 2007-03-26 09:48:51 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
Comment 1 Philip Van Hoof 2007-03-26 09:49:24 UTC
Created attachment 85308 [details] [review]
Proposal
Comment 2 Matthias Clasen 2007-04-11 13:33:25 UTC
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 ?
Comment 3 Philip Van Hoof 2007-04-11 14:30:56 UTC
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.
Comment 4 Matthias Clasen 2007-04-11 17:27:29 UTC
Right. 
I'm just curious if you have a concrete reason for this optimization, or if it is "just because".
Comment 5 Philip Van Hoof 2007-04-11 18:45:07 UTC
I noticed it while doing some performance measuring for tinymail. Nothing special, so it's mostly a "just because" indeed.
Comment 6 Philip Van Hoof 2009-01-06 22:43:44 UTC
Ping, what is the decision on this one? (cleaning up my bugs)
Comment 7 GNOME Infrastructure Team 2018-05-24 11:00:29 UTC
-- 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.