public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nathan Bossart <[email protected]>
To: Nazir Bilal Yavuz <[email protected]>
Cc: Manni Wood <[email protected]>
Cc: KAZAR Ayoub <[email protected]>
Cc: Neil Conway <[email protected]>
Cc: Andrew Dunstan <[email protected]>
Cc: Shinya Kato <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: Speed up COPY FROM text/CSV parsing using SIMD
Date: Wed, 11 Mar 2026 15:42:38 -0500
Message-ID: <abHTvkeIK37hj9oS@nathan> (raw)
In-Reply-To: <CAN55FZ0yfETy4UEA5rOJ9S06JSOtiWF8TW_+yi3yjVAcrLqKLA@mail.gmail.com>
References: <aaXrGSyq4u2d9qEC@nathan>
	<CAN55FZ2DNaKCK3Kf_kHizb2pAbQvULeDYtzaiz97B_xz7YbrkQ@mail.gmail.com>
	<aa8QlTVEDhG1JU0Z@nathan>
	<CAN55FZ08kqmA+B9pzPDy-QstxAd=cK-RqjbR3cWBjPF_8-FXAw@mail.gmail.com>
	<abBQbdFa6OsG8TGu@nathan>
	<CAN55FZ3jXs7XDsP_-v_jUBquRu4uAdheN3xcmW=WhAyKwFLSjg@mail.gmail.com>
	<abGv0ScUWVa6eogw@nathan>
	<CAN55FZ3gdK8dGrEo0M6KFW97OaF8TUbjO_dFoxQKi63davE-jA@mail.gmail.com>
	<abG8R6HkOHyUuyWb@nathan>
	<CAN55FZ0yfETy4UEA5rOJ9S06JSOtiWF8TW_+yi3yjVAcrLqKLA@mail.gmail.com>

On Wed, Mar 11, 2026 at 10:22:18PM +0300, Nazir Bilal Yavuz wrote:
> Here is v14 which is v13-0001 + v13-0002.

Thanks!  It's getting close.

> +		/*
> +		 * Temporary variables are used here instead of passing the actual
> +		 * variables (especially input_buf_ptr) directly to the helper. Taking
> +		 * the address of a local variable might force the compiler to
> +		 * allocate it on the stack rather than in a register.  Because
> +		 * input_buf_ptr is used heavily in the hot scalar path below, keeping
> +		 * it in a register is important for performance.
> +		 */
> +		int			temp_input_buf_ptr;
> +		bool		temp_hit_eof = hit_eof;

A few notes:

* Does using a temporary variable for hit_eof actually make a difference?
AFAICT that's only updated when loading more data.

* Does inlining the function produce the same results?

* Also, I'm curious what the usual benchmarks look like with and without
this hack for the latest patch.

-- 
nathan





view thread (114+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Speed up COPY FROM text/CSV parsing using SIMD
  In-Reply-To: <abHTvkeIK37hj9oS@nathan>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox