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 1vSUhz-00FhAT-1q for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Dec 2025 06:26:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vSUhy-00F2bB-0U for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Dec 2025 06:26:54 +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 1vSUhx-00F2b1-2k for pgsql-hackers@lists.postgresql.org; Mon, 08 Dec 2025 06:26:54 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vSUhw-003nW9-0r for pgsql-hackers@lists.postgresql.org; Mon, 08 Dec 2025 06:26:53 +0000 Received: by mail-qt1-x843.google.com with SMTP id d75a77b69052e-4edf1be4434so28419701cf.1 for ; Sun, 07 Dec 2025 22:26:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765175210; x=1765780010; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=XOAw8MSEQYlL1Qo2mH4R5zqF1NI5zN94v+U1fj/deZw=; b=d0mZg6jXIXVquLPUp+j2jDQlWY9+tIJlBGjzl5Gvz/KYqLJI2hVcAfnhHhoyHIpODt waHg9CKQpERpKUqO1geRdZZK/Xv8rY5B6+j8jjru4TOVai5ik0k1eQ5wT7jqlYvKhZHF iuHJjltpeKEIPJLomx75209riimmekA1Lioqwj8oGNRStsy2KC0CkHsdVtr/ww6xFqzS yolkLhFYQtmqwSgNQUQZkqB5rePqmRkI2qk+nBMUXuiEAhqDgIH27saC9j2KXjbaA8eU OQLqpx7ubnuCKsXV/GeqAYmZISvTlngUqkS2n9RUxKxIHNTdb1N9nXdohdaDQ2vC2iQ+ V38g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765175210; x=1765780010; h=content-transfer-encoding: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=XOAw8MSEQYlL1Qo2mH4R5zqF1NI5zN94v+U1fj/deZw=; b=FWGecs32/xRUD6IZzFSlkzoLS+oQODQgQki4zoX4wtWe3P3o4xuVZqtSL1deZJR51B L9XcnL3yOa8UoTkv6llKhhhxFguPzwx10od4qxiDYdnViDCuammxw8uZq35YfkmgCrw0 j3u/Ny/VVv4D/CCfaFEZrblrrkns7MGwMcxHVQhW3B17ktByBk4L9A65CGV1yavjD7px Q/dkplT9jnIF52Dd3uqDplxbXPrR1YpGLTfooOVkNy1AvbZqOUJ9DQtFCz94QQ/aRHYZ 3lOx8Vhhqb6lFq2zZLIV239gWTEjzgOW84J2Rk6FNqz8kFOYJwyFRlD1XMCipXzq9vzV 75Mw== X-Forwarded-Encrypted: i=1; AJvYcCUhLY/cH7RBVgMTg2YFb3CgeAjbgW0fqYm1Ny7F30VNTVxhmH9zN+ERhi05B5oZXU1kLWhpWZi82OvtiGop@lists.postgresql.org X-Gm-Message-State: AOJu0YyCIA3D9/gf8ja94yPLaSaq/XEKabQPQCOvSpKIaiQKon7zv2i9 y6wVrLRQZ6cZUqA1oZDnUGr/t99XDd3kB1r9moieGAXqNqz3QECR7C4LhkEnrz/Dm/+W9xDyjgY AnO+cCahXhajOXNoE1TdIqvvhMxI3Yx4= X-Gm-Gg: ASbGnctYvK6kquhwcaHrxS32Cgip4IDVIAitNNPBhnkX+z4VBmTGur6jZhcKyEHBTBf 46heA9HyjFPYAGZcrIVZzwciCe+Oc31QELX72shEIx7ekerhUV5Cxx+PW2vZ+ndbu9F4ZmjZKfm FV7+hmIQqbcKuCT1m2EaLlPX2itGgJZiTHDPnaBU9zW1KK0Us4NHF3BFUnRR3QWkU5LaEuvalQj bdiC9dBYn4/t+TO+EUGypUtBQnxR5BVObAmKY/o7Msrd+jLS3zLwRV2dzvTdnKV7jjOEzuFiTlg d6R8iTTK31QCu5bB0tcIoD/shpgmSZgOBoIp6uqmL+9pRi8mnxnAPuzne8UkJMMdPltf27pPKkW nF7ky6bWrfdoNAZ4= X-Google-Smtp-Source: AGHT+IF8QqjGbqrrLrp2kMlyTsKzRpdwLtOT/1Bc+E/CXwoNDhZ0BPspb5sRNixonPra8BCnlr3dn22KjnXsfoc/tUk= X-Received: by 2002:a05:622a:303:b0:4e8:aa11:5869 with SMTP id d75a77b69052e-4f03ff326cemr104019251cf.70.1765175210111; Sun, 07 Dec 2025 22:26:50 -0800 (PST) MIME-Version: 1.0 References: <269A8FB9-6D43-43CF-A6FE-52D28CBDB8A9@Outlook.com> <606C775A-4C1A-482B-BE7D-2E7A46AE14B9@gmail.com> <9D3D4647-868B-4562-B382-D201478AD67B@gmail.com> In-Reply-To: <9D3D4647-868B-4562-B382-D201478AD67B@gmail.com> From: John Naylor Date: Mon, 8 Dec 2025 13:26:38 +0700 X-Gm-Features: AQt7F2o6CZW7UDc3oCKzLygRX-1RiGyi095SELZCaAtrNoWFPDsqmjjG3cqqgfQ Message-ID: Subject: Re: tuple radix sort To: Chao Li Cc: Chengpeng Yan , "pgsql-hackers@lists.postgresql.org" , Peter Geoghegan Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Dec 8, 2025 at 9:52=E2=80=AFAM Chao Li wro= te: > First, I changed my direction and implemented the in-place switching in t= he other way, where I did a way like chained-switching. Say starting from i= tem0, for example, switching item0 to item5, then check where item5 should = be switched to, and makes the switch, till an item is switch to position 0.= See my implementation in other-implemation.diff if you are interested in i= t. This time, I eyeball checked the sort result and confirmed the correctio= n. But my implementation is slightly slower than your implementation, based= on the same test procedure I described in my previous email, my implementa= tion is roughly ~3% slower your implementation. So I think that at least pr= oves your current implementation in v5 has been perfectly fine tuned. That shouldn't be surprising, since the way you describe is basically "American flag sort", which is much older, and the innovation of ska_byte_sort was to recognize that this is bad for CPU pipelining. That was explained in detail in the blog post I linked to in my first email. Also notice that by attaching a .diff, the CF bot tries and fails to apply that to master, and has been complaining that my patch needs a rebase. Please don't do that again. -- John Naylor Amazon Web Services