Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w0QOF-001tTO-2d for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Mar 2026 20:42:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w0QOD-00Bi4d-1D for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Mar 2026 20:42:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w0QOD-00Bi4U-05 for pgsql-hackers@lists.postgresql.org; Wed, 11 Mar 2026 20:42:45 +0000 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w0QOA-00000002C47-3T8O for pgsql-hackers@postgresql.org; Wed, 11 Mar 2026 20:42:44 +0000 Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-7d75d698ee6so227788a34.3 for ; Wed, 11 Mar 2026 13:42:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773261761; x=1773866561; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=bt7pdNy1VxTi7Gl6J+zlBGC2NQgmDNziosbbRNrPQVM=; b=YD0s/4yTnwqGWALeZeKAycVfKBfIpOqL5nqUbRE9qJYNfVNZj2o0Gd7we73MMH0Lmt mKh2fU6X6y4eLZVniBs/HahxfDG5j8NDGNg+w6wqI/Jbaq+pWXcBem5XtwfgTMRIF8c6 mY06ya4FH0qHTYPXFce/T8xWmQfm3ictxAWj8TOzws+QpXVCWQCNz1Ekp8Cd075TvtuY 66DH28gv+LcOVgq8fM5yuNR7oVq9H4PbqR2l7owQC/LtavlY7/gDqS6OCaxx36aZvh+S 9wH/Q8YCriFGSBvww2pV/Ka2FYEXmN8rv6RQ/C7Op6uIGULFBlvvkTcJcUuKnFI5Q53l goqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773261761; x=1773866561; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bt7pdNy1VxTi7Gl6J+zlBGC2NQgmDNziosbbRNrPQVM=; b=MHw2Qji/mwwTjQKYp7KUKKrtrMz7WShUK2oGMKkWfyFos2FQSp6cXAi00AaDN+xhUF oCQS2xtDDE9ZEc6LYFXTLa7UAbD7rywHSTvuiuq2rByefEJkAOfl3NtLiZ+ioGcCR5Tn rfsj7Mj59MuS+E1ctLmzmixscJ0GjSfJTA6Or2d2m4KWGAnk1aQRspwwldOP+iVX2lVg fDhh0Mm3eS82y8etqNQUQns67G6iAsv08eFj5Tf9mPvPCSH8iaIqHpjIrrCAt6VUmolh hxNl4+uEYBiF1uaaDgW69VDs597u4jA+SYKfbrqJDPW5QHiP+JieVloRNTd1kLgDTHPJ t6cw== X-Forwarded-Encrypted: i=1; AJvYcCXxZxhlXKQ5NunXdO+xyCFioywGpuR+4aDFoDYMZftcdf0bmjZ+IMiOU8bFnDCNHDyGdAqy+GZ75MmF4D6+@postgresql.org X-Gm-Message-State: AOJu0YwjLTJsJwQrZWGb9k/1mitdl3nbj08PVQhatXRKz/wI4a73l48G j2hqDfxYnquXBLMCTAtzALDiUkuZI82/YC9dl9IfErpjbi8DnKB+5/Wf X-Gm-Gg: ATEYQzyLn4/+5BXUTRwLEUqnnHfScOjfNg9D9XQ3tvMqA582vbwGLShj0q6kyhTn9cy jcBAX4OMctISNrVdOlthQ4OESxk8aT8r5PIXm7GgPYjlGa8o1vQekVrgGXj4lEVsTdqxwMnNl32 defz4XTGnSAKHWl9lUHcEZa+AY4d3WmVN4ypQPhGc9AoUVNdreudQn7dN7gLbvZo6NIxQ5NKnbT ZvfVw3JvZ26B7JIefUzxvJKL51WU37e4dMxivzmlsaQzf8rg3oaBAkF8hJVUya5j5bTQNfdfxRT xE+8H+jCFieib1xFDzNE3W3EafzS5mnTzMW0vGJ9uWT13HdnCDBegw/CQibL/1weOS3xIEWe1I0 C96VzmKW0DoilwlN6QTNvEwV5awIlf88kw4Z0yaBm0s9lhd4h9RQbo5SFMrvrqXLiMpJ6SAPKvs N0cOM5WZuqTiXc7K0mmVxK18CFREs+iVMlzEUww3jpF4NxY74KTlg6Ym4wd3lplB0T+gPx92TDT jO/8cWUY1Ax5qRG0vYhDg== X-Received: by 2002:a05:6830:2116:b0:7d7:5c67:bce with SMTP id 46e09a7af769-7d76a81746amr2162582a34.27.1773261760731; Wed, 11 Mar 2026 13:42:40 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7d76ac32913sm2716821a34.5.2026.03.11.13.42.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 13:42:40 -0700 (PDT) Date: Wed, 11 Mar 2026 15:42:38 -0500 From: Nathan Bossart To: Nazir Bilal Yavuz Cc: Manni Wood , KAZAR Ayoub , Neil Conway , Andrew Dunstan , Shinya Kato , PostgreSQL-development Subject: Re: Speed up COPY FROM text/CSV parsing using SIMD Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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