Re: Speed up COPY FROM text/CSV parsing using SIMD - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: Speed up COPY FROM text/CSV parsing using SIMD
Date
Msg-id abHTvkeIK37hj9oS@nathan
Whole thread Raw
In response to Re: Speed up COPY FROM text/CSV parsing using SIMD  (Nazir Bilal Yavuz <byavuz81@gmail.com>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: alter check constraint enforceability
Next
From: Jacob Champion
Date:
Subject: Re: [PATCH] libpq: try all addresses for a host before moving to next on target_session_attrs mismatch