avoid some calls to memset with array initializer

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: avoid some calls to memset with array initializer
Date: 2020-01-02 16:38:35
Message-ID: 20200102163834.GA3183@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Is there any appetite for use of array initializer rather than memset, as in
attached ? So far, I only looked for "memset.*null", and I can't see that any
of these are hot paths, but saves a cycle or two and a line of code for each.

gcc 4.9.2 with -O2 emits smaller code with array initializer than with inlined
call to memset.

$ wc -l contrib/pageinspect/heapfuncs.S?
22159 contrib/pageinspect/heapfuncs.S0
22011 contrib/pageinspect/heapfuncs.S1

Also true of gcc 5.4. And 7.3:

25294 contrib/pageinspect/heapfuncs.S0
25234 contrib/pageinspect/heapfuncs.S1

Attachment Content-Type Size
v1-0001-Avoid-some-calls-to-memset.patch text/x-diff 22.5 KB
v1-0002-Some-less-useful-changes-to-avoid-memset.patch text/x-diff 12.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2020-01-02 16:59:35 Re: Greatest Common Divisor
Previous Message Justin Pryzby 2020-01-02 16:27:01 Re: error context for vacuum to include block number