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 1vuxDx-00EPwk-2G for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Feb 2026 18:33:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vuxDw-002tyb-2A for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Feb 2026 18:33:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vuxDw-002tyS-16 for pgsql-hackers@lists.postgresql.org; Tue, 24 Feb 2026 18:33:32 +0000 Received: from mail-yw1-x112e.google.com ([2607:f8b0:4864:20::112e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vuxDt-00000000zzf-1oJm for pgsql-hackers@lists.postgresql.org; Tue, 24 Feb 2026 18:33:31 +0000 Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-7984d31b895so21480977b3.1 for ; Tue, 24 Feb 2026 10:33:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1771958010; cv=none; d=google.com; s=arc-20240605; b=VlQOx3lqH+fqd7kHgwXHewF8oAgwy13aL/fx31aYpDiaw3zj3dJmYed2IBcKTWp3Pr RVGI34fxPNrZ0nao8GXjdLuc3mMg/3kxqvt60wamp7sHI/rGqdcgKPPKJZvV9frXA8nc b0+2tj9zPqnKwKY0KV0quXbgsh6Ac/Cm+o1A6XAMLf+4ym2XB6g/PdOV0hXdJ4wrrGFk pLc870yoRePlBl8Pix8DOfQK9AxrGxBOycyw+5QjkJzbeeUZzKk/+fnQGdQ7lZPTQJGt qZkaT2V4uds1GzJN/D75XlYgPxq59YVjoM8/xNZQE1ENvY6KIwB2YP26b+7bpKmDhc53 hWkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=EQMPcsvvdPDXFa2t+X/i/EhRDsLtzTrkUrZ9Nym5oA0=; fh=S9A2lvFvbkf+hCUgzeN5QQqMJBIQ99OZrOsI6lHrDGM=; b=S77RPUe7HKdrl47i0ymO27WO+27bWVd6SYaSyywjVUOHKQCmOFtbc4fVt+4oFmGtSG 9dzSC7sid3BnKo63cMrijjbyXVr55lr5NHF59H+enJvUYOvwA/3YN5FTUnDvXVCR/S60 BR6HSmWO+a+DFH8mBSZfl9YQPxhMMGe2z4pZnT58q25ZOaEiZysXpvQQv8VquIb+7r+N adj5yTofHxSRC/s87RJBHASn+qwHDxZprcv6Amjq/mu3LFQqnwSHDaglfWalupxqYS0o H/F0BwYKZZZx/ff+2i0KDrPtGtb1h9veoBSUOoNMARUh16EJP+IKJae0IZmzqbLP1SYI gkwA==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=percona.com; s=google; t=1771958010; x=1772562810; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=EQMPcsvvdPDXFa2t+X/i/EhRDsLtzTrkUrZ9Nym5oA0=; b=FcInBzYqgadMIILOtlMod/oEwzzs4gL85oWVfeNy/Ti14nCmvSsKmm88HLcBe7mGuB bQrfhxRiOAsNnBXSZSfkP6WsgzyLgjHgBYVsBdxp4x75a6AAmHvHUbW7ykRs2sIDtA9M XRL9LcCBevX86XpElzrOz6dnzR0mgo4FuA4lI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771958010; x=1772562810; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EQMPcsvvdPDXFa2t+X/i/EhRDsLtzTrkUrZ9Nym5oA0=; b=phPnrF8SvTtEMwrT1ipANAWfuycWFAoqCHz3aBZ+Bk4eK6PfzcbTw4zoHQKA6yNmLc x8vQam1Tfupo9Bbkzgb3RkkabdvuSvrwTLQR1xahBz1MIByLThyChzrr+/nniAW13mnc VHIZcdEsmHt5cFnwyI8f6FvfQv81qk/T10J0Vpi+nmdJ+xS3cPiE843BMjN+cOu4ppTc GenweO3aJ2o5WgB8Osq3YLaKEY/7bHyeFNhTkwas726IsbzPt260+zSTvQcZe0Vmq/q9 FpOCpWlmuWszhZ40wMqOQd9ED2Va7o8G/84ZOCW1Caa/MwVjo94nJWYQm0DtuRoyjbZB mdsA== X-Forwarded-Encrypted: i=1; AJvYcCWT3LbSPeZPfFGXWamCVVrCuGWiU3NqeCdxfYhwfjQwqXQvyYbHA8BudFT+vcmuJe6X6kcPvb7jTs0EMjYz@lists.postgresql.org X-Gm-Message-State: AOJu0YwkgzErNsUcSc+wh+q7fMGHSe6QuqkXwrWMqeazl3Ngfj/tRKW2 5p92yO+8N/Xl3LoPDNaIjvqj5xwUFOcQKZ/jlHHxw7ogMl3bbZyTuUysw9pJtUb1DHnRqm8EU3v UnUzlWSy+4wTcQWmNzswDcwMKXTfYOwrktevCMRpXI/MhH9UEwbmLZYLkunANnc+qvD5JNQ2PSE tQPVoNQVvEswiqzRrprBeKcIsFZPd6Fji7VYQxHi1+Hx3n41trw4Prmsxz6ywngYWstKYmoFQpb jGSKE9VVufhQiSpw6lzycAY4DtICZ1aqNEAF+hUl0yJxSNfkK2o/acFw2D9srgG0XQ= X-Gm-Gg: ATEYQzxpxc6imujzYs/Ax94oBF1yu59agt2HfKH2nWBCUMHPI25LLKwbZasa7ciZ1Nj vCZeQ42Frfj5imbtrlB/aBVtAV0609KeKbhThiC3FiD35Mw9g1wGhPOo7sHOVYfaMr+3hfU7lVA zskSfp+YnD1U9CaIfxbWEdolKiVNRCvo/Hyr3/0anXIKpG9r9njyZWucxOt8ogLjFcQVVD+Y3Zt XcJKQPFqyMrMfg2UMM00AjwyVuisj1J36oJs+OO+Ws9s7O2Yeh2ipgeDQVxn85jiuqs52ZHtM62 U0Z8b69uvDsxA4Jn0SWLgx7F0i/PIVqF7mGZTzdZH4Q5JbLSw4Q1Nny3zo7bEqdysDYu X-Received: by 2002:a05:690c:60ca:b0:797:ce9d:5c8b with SMTP id 00721157ae682-79828fc1d1bmr121767787b3.31.1771958009436; Tue, 24 Feb 2026 10:33:29 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Zsolt Parragi Date: Tue, 24 Feb 2026 18:33:19 +0000 X-Gm-Features: AaiRm537-ekoYWue0oxQxf8vdK28H_Or6zixOXdeWLMWpq807rdnmzUXI61Af7Q Message-ID: Subject: Re: More speedups for tuple deformation To: David Rowley Cc: Andres Freund , John Naylor , Chao Li , PostgreSQL Developers Content-Type: text/plain; charset="UTF-8" X-CLOUD-SEC-AV-Sent: true X-CLOUD-SEC-AV-Info: percona,google_mail,monitor X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello + * We expect that 'bits' contains at least one 0 bit somewhere in the mask, + * not necessarily < natts. + */ Is this precondition really enough? Let's say we have 20 attributes, only attribute 20 is NULL Caller requests natts=8 That sets lastByte = 1, loop only checks bits[0], which is 0xFF, exits with bytenum=1, bits[1] is also 0xFF Then we execute + res += pg_rightmost_one_pos32(~bits[bytenum]); where ~0xFF = 0 + /* convert the lower 4 bits of null bitmap word into 32 bit int */ + isnull_8 = (nullbyte & 0xf) * SPREAD_BITS_MULTIPLIER_32; + + /* + * convert the upper 4 bits of null bitmap word into 32 bit int, shift + * into the upper 32 bit + */ + isnull_8 |= ((uint64) ((nullbyte >> 4) * SPREAD_BITS_MULTIPLIER_32)) << 32; + + /* mask out all other bits apart from the lowest bit of each byte */ + isnull_8 &= UINT64CONST(0x0101010101010101); + memcpy(isnull, &isnull_8, sizeof(uint64)); Won't this mix up column numbers on big-endian systems? Subject: [PATCH v9 1/5] Introduce deform_bench test module For benchmaring tuple deformation. --- Typo: should be benchmarking + * firstNonGuaranteedAttr stores the index to info the compact_attrs array for to info should be "into"?