Re: Refactor CheckpointWriteDelay() - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Refactor CheckpointWriteDelay()
Date
Msg-id 20220219215059.rhptoyii4gpiuyi7@alap3.anarazel.de
Whole thread Raw
In response to Refactor CheckpointWriteDelay()  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
List pgsql-hackers
Hi,

On 2022-02-10 17:31:55 +0530, Bharath Rupireddy wrote:
> Secondly, remove the function ImmediateCheckpointRequested() and read
> the ckpt_flags from the CheckpointerShmem with volatile qualifier.
> This saves some LOC and cost = dirty buffers written to disk * one
> function call cost.

The compiler can just inline ImmediateCheckpointRequested(). We don't gain
anything by inlining it ourselves.


> I did a small experiment[1] with a use case [2] on my dev system where
> I measured the total time spent in CheckpointWriteDelay() with and
> without patch, to my surprise, I didn't see much difference. It may be
> my experiment is wrong, my dev box doesn't show much diff and others
> may or may not notice the difference. Despite this, the patch proposed
> still helps IMO as it saves a few LOC (16) and I'm sure it will also
> save some time for standalone backend checkpoints.

I am not surprised that you're not seeing a benefit. Compared to the cost of
writing out a buffer the cost of the function call here is neglegible.

I don't think this is an improvement at all. Imagine what happens if we add a
second callsite to CheckpointWriteDelay() or
ImmediateCheckpointRequested()...


Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: MultiXact\SLRU buffers configuration
Next
From: Andrew Dunstan
Date:
Subject: Re: killing perl2host