Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

People are going to scream bloody murder about that. -- Seen on linux-kernel


devel / comp.arch / Re: Faster Sort Algorithms

SubjectAuthor
* Faster Sort AlgorithmsMitchAlsup
+- Re: Faster Sort AlgorithmsBGB
+* Re: Faster Sort AlgorithmsTerje Mathisen
|+- Re: Faster Sort AlgorithmsThomas Koenig
|`* Re: Faster Sort AlgorithmsStephen Fuld
| `* Re: Faster Sort AlgorithmsTerje Mathisen
|  `* Re: Faster Sort AlgorithmsTerje Mathisen
|   `- Re: Faster Sort AlgorithmsMichael S
+* Re: Faster Sort AlgorithmsEricP
|`* Re: Faster Sort AlgorithmsEricP
| `* Re: Faster Sort AlgorithmsMitchAlsup
|  +- Re: Faster Sort AlgorithmsTerje Mathisen
|  `* Re: Faster Sort AlgorithmsEricP
|   +* Re: Faster Sort AlgorithmsAnton Ertl
|   |+* Re: Faster Sort Algorithmsrobf...@gmail.com
|   ||+* Re: Faster Sort AlgorithmsBGB
|   |||`* Re: Faster Sort AlgorithmsMitchAlsup
|   ||| `- Re: Faster Sort AlgorithmsBGB
|   ||+* Re: Faster Sort AlgorithmsMitchAlsup
|   |||+- Re: Faster Sort AlgorithmsEricP
|   |||`* Re: Faster Sort Algorithmsrobf...@gmail.com
|   ||| `* Re: Faster Sort AlgorithmsBGB
|   |||  `* Re: Faster Sort Algorithmsrobf...@gmail.com
|   |||   +- Re: Faster Sort Algorithmsrobf...@gmail.com
|   |||   `- Re: Faster Sort AlgorithmsBGB
|   ||`* Re: Faster Sort AlgorithmsEricP
|   || +- Re: Faster Sort AlgorithmsMitchAlsup
|   || `* Re: Faster Sort Algorithmsrobf...@gmail.com
|   ||  `* Re: Faster Sort AlgorithmsThomas Koenig
|   ||   `- Re: Faster Sort Algorithmsrobf...@gmail.com
|   |`* Re: Faster Sort AlgorithmsEricP
|   | +- Re: Faster Sort AlgorithmsScott Lurndal
|   | +- Re: Faster Sort AlgorithmsMitchAlsup
|   | +* Re: Faster Sort AlgorithmsThomas Koenig
|   | |+* Re: Faster Sort AlgorithmsEricP
|   | ||+* Re: Faster Sort AlgorithmsMitchAlsup
|   | |||`* Re: Faster Sort AlgorithmsThomas Koenig
|   | ||| `* Re: Faster Sort AlgorithmsMitchAlsup
|   | |||  +- Re: Faster Sort AlgorithmsTerje Mathisen
|   | |||  `* Re: Faster Sort AlgorithmsJohn Levine
|   | |||   `* Re: Faster Sort AlgorithmsScott Lurndal
|   | |||    `* Re: Faster Sort AlgorithmsBGB
|   | |||     `* Re: Faster Sort AlgorithmsJohn Levine
|   | |||      +* Re: Faster Sort AlgorithmsBGB
|   | |||      |`* Re: Faster Sort AlgorithmsMitchAlsup
|   | |||      | +- Re: Faster Sort AlgorithmsBGB
|   | |||      | +* Re: Faster Sort AlgorithmsJohn Levine
|   | |||      | |`- Re: Faster Sort AlgorithmsBGB
|   | |||      | `* Re: Faster Sort AlgorithmsTerje Mathisen
|   | |||      |  +* Re: Faster Sort AlgorithmsBGB
|   | |||      |  |`* Re: Faster Sort AlgorithmsTerje Mathisen
|   | |||      |  | `- Re: Faster Sort AlgorithmsBGB
|   | |||      |  `* Re: off topic - burying electrical linesGeorge Neuner
|   | |||      |   +- Re: off topic - burying electrical linesBGB
|   | |||      |   `- Re: off topic - burying electrical linesScott Lurndal
|   | |||      `- Re: Faster Sort AlgorithmsTerje Mathisen
|   | ||`- Re: Faster Sort AlgorithmsTerje Mathisen
|   | |+* Re: Faster Sort AlgorithmsMitchAlsup
|   | ||+* Re: Faster Sort AlgorithmsThomas Koenig
|   | |||+* Re: Faster Sort AlgorithmsMichael S
|   | ||||`* Re: Faster Sort Algorithmsrobf...@gmail.com
|   | |||| `- Re: Faster Sort AlgorithmsMichael S
|   | |||`* Re: Faster Sort AlgorithmsMitchAlsup
|   | ||| `* Re: Faster Sort AlgorithmsThomas Koenig
|   | |||  `- Re: Faster Sort AlgorithmsMitchAlsup
|   | ||+* Re: Faster Sort AlgorithmsTerje Mathisen
|   | |||`- Re: Faster Sort AlgorithmsTerje Mathisen
|   | ||`- Re: Faster Sort AlgorithmsScott Lurndal
|   | |`- Re: Faster Sort AlgorithmsTerje Mathisen
|   | `- Re: Faster Sort AlgorithmsAnton Ertl
|   `- Re: Faster Sort AlgorithmsTerje Mathisen
+- Re: Faster Sort AlgorithmsMarcus
`* Re: Faster Sort AlgorithmsMichael S
 `* Re: Faster Sort AlgorithmsMitchAlsup
  +- Re: Faster Sort AlgorithmsBill Findlay
  `* Re: Faster Sort AlgorithmsScott Lurndal
   `- Re: Faster Sort AlgorithmsMitchAlsup

Pages:1234
Re: Faster Sort Algorithms

<6c5d66c2-8014-4f87-aa09-2470fc6bb044n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32821&group=comp.arch#32821

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:622a:49:b0:3f6:aa29:b631 with SMTP id y9-20020a05622a004900b003f6aa29b631mr3870148qtw.2.1686659425153;
Tue, 13 Jun 2023 05:30:25 -0700 (PDT)
X-Received: by 2002:aca:b556:0:b0:39c:8723:a96 with SMTP id
e83-20020acab556000000b0039c87230a96mr2838213oif.1.1686659424874; Tue, 13 Jun
2023 05:30:24 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Tue, 13 Jun 2023 05:30:24 -0700 (PDT)
In-Reply-To: <u693iu$2vqpg$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=199.203.251.52; posting-account=ow8VOgoAAAAfiGNvoH__Y4ADRwQF1hZW
NNTP-Posting-Host: 199.203.251.52
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<FVlgM.4315$fZx2.2545@fx14.iad> <rPIgM.11831$fZx2.2801@fx14.iad>
<90ea8cc3-2ae8-4401-97a1-f9285e7588c5n@googlegroups.com> <CckhM.10390$NuA9.3884@fx03.iad>
<2023Jun11.163044@mips.complang.tuwien.ac.at> <6mIhM.58859$d1y5.51140@fx17.iad>
<u681a9$2v4pe$1@newsreader4.netcologne.de> <d8406fa3-b88e-4ba5-885e-ed03b3cdd1b6n@googlegroups.com>
<u693iu$2vqpg$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6c5d66c2-8014-4f87-aa09-2470fc6bb044n@googlegroups.com>
Subject: Re: Faster Sort Algorithms
From: already5chosen@yahoo.com (Michael S)
Injection-Date: Tue, 13 Jun 2023 12:30:25 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Michael S - Tue, 13 Jun 2023 12:30 UTC

On Tuesday, June 13, 2023 at 9:50:10 AM UTC+3, Thomas Koenig wrote:
> MitchAlsup <Mitch...@aol.com> schrieb:
> > On Monday, June 12, 2023 at 4:05:16 PM UTC-5, Thomas Koenig wrote:
> >> Hmm.. a couple of thoughts.
> >>
> >> Assumme we have the three-operand instructions
> >>
> >> MIN Rt,Ra,Rb,Rc
> >> MID Rt,Ra,Rb,Rc
> >> MAX Rt,Ra,Rb,Rc
> ><
> > In the 1980s and very early '90s, some designers thought about using
> > CAM sort arrays* in hardware. Software would load up a number of
> > values and write them into the "sorter", after loading all values, soft-
> > ware would read out all the value in order. No instruction was needed
> > to cause the sorter to sort, the writing of values in performed sorting..
> ><
> > These never went anywhere--draw your own conclusions.
> The pendulum of reintegration swung the other way, quickly.
>
> Although there appears to be a SORTL instruction on zSystem, according to
> https://blog.share.org/Article/peeking-under-the-hood-of-sort-acceleration-on-z15
> which appears to bring some improvement, so...
> ><
> > (*) CAMs can be made to do things other than exact match detection.
> Interesting.
>
> MIN and MAX of three registers is straightforward two instructions,
> but MID is more challenging. It could be something like
>
> MIN Rtmp1,Ra,Rb
> MIN Rtmp2,Ra,Rc
> MIN Rtmp3,Rb,Rc
> MAX Rtmp1,Rt1,Rt2
> MAX Rtmp1,Rt1,Rt3
>
> with (assuming single-cycle latency) anything between three
> (for a sufficiently wide OoO machine) and five cycles of latency.
>
> The last two instructions would be a three-way MAX, so this
> could be shortened to
>
> MIN Rtmp1,Ra,Rb
> MIN Rtmp2,Ra,Rc
> MIN Rtmp3,Rb,Rc
> MAX Rtmp1,Rtmp1,Rtmp2,Rttmp3
>
> in that case, for between two and four cycles (assuming that
> three-way MAX is a single cycle). For OoO, MID is then probably
> not worth it, especially if it is can not be done in a single
> cycle.
>
> Three-way sort could then be
>
> MIN Rmin,Ra,Rb,Rc
> MAX Rmax,Ra,Rb,Rc
> MIN Rtmp1,Ra,Rb
> MIN Rtmp2,Ra,Rc
> MIN Rtmp3,Rb,Rc
> MAX Rmid,Rtmp1,Rtmp2,Rttmp3
>
> so between two and six cycles.

The key question is: how often do people sort arrays of numbers?
My guess is, in fields of signal and image processing they do it not very
rarely, but also not often. And typical size here is from 2-3 to low hundreds.

In other fields of computing, like commercial, scientific, data analytics,
sorting arrays of numbers is *extremely* rare.

What is not rare is sorting arrays of records by numeric key.
Of which most important case is sorting small records consisting of
numeric key and pointer-or-index.

Max and min instruction are probably far less useful in this mighty
important case then they are in less important case of sorting arrays of number.

Re: Faster Sort Algorithms

<6i_hM.31126$AF%b.19093@fx12.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32822&group=comp.arch#32822

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx12.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Faster Sort Algorithms
Newsgroups: comp.arch
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com> <FVlgM.4315$fZx2.2545@fx14.iad> <rPIgM.11831$fZx2.2801@fx14.iad> <90ea8cc3-2ae8-4401-97a1-f9285e7588c5n@googlegroups.com> <CckhM.10390$NuA9.3884@fx03.iad> <2023Jun11.163044@mips.complang.tuwien.ac.at> <6mIhM.58859$d1y5.51140@fx17.iad> <u681a9$2v4pe$1@newsreader4.netcologne.de> <d8406fa3-b88e-4ba5-885e-ed03b3cdd1b6n@googlegroups.com>
Lines: 58
Message-ID: <6i_hM.31126$AF%b.19093@fx12.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 13 Jun 2023 13:37:06 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 13 Jun 2023 13:37:06 GMT
X-Received-Bytes: 3225
 by: Scott Lurndal - Tue, 13 Jun 2023 13:37 UTC

MitchAlsup <MitchAlsup@aol.com> writes:
>On Monday, June 12, 2023 at 4:05:16=E2=80=AFPM UTC-5, Thomas Koenig wrote:
>> Hmm.. a couple of thoughts.=20
>>=20
>> Assumme we have the three-operand instructions=20
>>=20
>> MIN Rt,Ra,Rb,Rc=20
>> MID Rt,Ra,Rb,Rc=20
>> MAX Rt,Ra,Rb,Rc=20
><
>In the 1980s and very early '90s, some designers thought about using=20
>CAM sort arrays* in hardware. Software would load up a number of=20
>values and write them into the "sorter", after loading all values, soft-
>ware would read out all the value in order. No instruction was needed
>to cause the sorter to sort, the writing of values in performed sorting.
><
>These never went anywhere--draw your own conclusions.
><
>(*) CAMs can be made to do things other than exact match detection.
>>=20
>> which would, as the name suggests, select the minimum, the mitpoint=20
>> and the maximum of three values. Are these instructions which=20
>> could reasonably be done in a single cycle, and issued in parallel=20
>> on an OoO machine? That should certainly speed up three-way=20
>> sorting, if this is reasonable.=20
><
>Yours is only the 3-operand version, the array I mentioned above=20
>was 32 entry or 64 entry (its been too long).
>>=20
>> Another idea, potentially even wilder (and probably worse :-)=20
>> A "load double and sort" instruction, so=20
>>=20
>> LS Rmin,Rmax,[Rs]=20
>>=20
>> would load the maximum of [Rs] and [Rs+offs] into Rmax and the=20
>> minimum of [Rs] and [Rs+offs], with offs being the size of the=20
>> data loaded.=20
>>=20
>> Comments? Too horrible even to think about? Has been tried and=20
>> does not work because...?
><
>I, personally, do not think it a good idea to add a comparison stage=20
>to the already difficult AGEN-CACHE-ALIGN portion of the memory
>pipeline.

Well, does it have to done in the pipeline? Or at the memory
controller.

For instance, ARM64 has STSMAX (Atomic store signed maximum):

Atomic signed maximum on word in memory, without return,
atomically loads an 64-bit byte from memory, compares
it against the value held in a register, and stores the
larger value back to memory, treating the values as signed
numbers.

Granted, not particulary performant in a tight integer sort
loop.

Re: Faster Sort Algorithms

<857761a7-a108-495e-a6cc-b0fa424adb76n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32823&group=comp.arch#32823

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a37:9a82:0:b0:75c:1d3e:5324 with SMTP id c124-20020a379a82000000b0075c1d3e5324mr1415277qke.2.1686669012125;
Tue, 13 Jun 2023 08:10:12 -0700 (PDT)
X-Received: by 2002:a05:6830:1ca:b0:6b2:b563:82b1 with SMTP id
r10-20020a05683001ca00b006b2b56382b1mr3756787ota.7.1686669011639; Tue, 13 Jun
2023 08:10:11 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.1d4.us!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!feeder1.cambriumusenet.nl!feed.tweak.nl!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Tue, 13 Jun 2023 08:10:11 -0700 (PDT)
In-Reply-To: <6c5d66c2-8014-4f87-aa09-2470fc6bb044n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2607:fea8:1dde:6a00:b4f9:2673:e18:71ab;
posting-account=QId4bgoAAABV4s50talpu-qMcPp519Eb
NNTP-Posting-Host: 2607:fea8:1dde:6a00:b4f9:2673:e18:71ab
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<FVlgM.4315$fZx2.2545@fx14.iad> <rPIgM.11831$fZx2.2801@fx14.iad>
<90ea8cc3-2ae8-4401-97a1-f9285e7588c5n@googlegroups.com> <CckhM.10390$NuA9.3884@fx03.iad>
<2023Jun11.163044@mips.complang.tuwien.ac.at> <6mIhM.58859$d1y5.51140@fx17.iad>
<u681a9$2v4pe$1@newsreader4.netcologne.de> <d8406fa3-b88e-4ba5-885e-ed03b3cdd1b6n@googlegroups.com>
<u693iu$2vqpg$1@newsreader4.netcologne.de> <6c5d66c2-8014-4f87-aa09-2470fc6bb044n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <857761a7-a108-495e-a6cc-b0fa424adb76n@googlegroups.com>
Subject: Re: Faster Sort Algorithms
From: robfi680@gmail.com (robf...@gmail.com)
Injection-Date: Tue, 13 Jun 2023 15:10:12 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 5152
 by: robf...@gmail.com - Tue, 13 Jun 2023 15:10 UTC

On Tuesday, June 13, 2023 at 8:30:27 AM UTC-4, Michael S wrote:
> On Tuesday, June 13, 2023 at 9:50:10 AM UTC+3, Thomas Koenig wrote:
> > MitchAlsup <Mitch...@aol.com> schrieb:
> > > On Monday, June 12, 2023 at 4:05:16 PM UTC-5, Thomas Koenig wrote:
> > >> Hmm.. a couple of thoughts.
> > >>
> > >> Assumme we have the three-operand instructions
> > >>
> > >> MIN Rt,Ra,Rb,Rc
> > >> MID Rt,Ra,Rb,Rc
> > >> MAX Rt,Ra,Rb,Rc
> > ><
> > > In the 1980s and very early '90s, some designers thought about using
> > > CAM sort arrays* in hardware. Software would load up a number of
> > > values and write them into the "sorter", after loading all values, soft-
> > > ware would read out all the value in order. No instruction was needed
> > > to cause the sorter to sort, the writing of values in performed sorting.
> > ><
> > > These never went anywhere--draw your own conclusions.
> > The pendulum of reintegration swung the other way, quickly.
> >
> > Although there appears to be a SORTL instruction on zSystem, according to
> > https://blog.share.org/Article/peeking-under-the-hood-of-sort-acceleration-on-z15
> > which appears to bring some improvement, so...
> > ><
> > > (*) CAMs can be made to do things other than exact match detection.
> > Interesting.
> >
> > MIN and MAX of three registers is straightforward two instructions,
> > but MID is more challenging. It could be something like
> >
> > MIN Rtmp1,Ra,Rb
> > MIN Rtmp2,Ra,Rc
> > MIN Rtmp3,Rb,Rc
> > MAX Rtmp1,Rt1,Rt2
> > MAX Rtmp1,Rt1,Rt3
> >
> > with (assuming single-cycle latency) anything between three
> > (for a sufficiently wide OoO machine) and five cycles of latency.
> >
> > The last two instructions would be a three-way MAX, so this
> > could be shortened to
> >
> > MIN Rtmp1,Ra,Rb
> > MIN Rtmp2,Ra,Rc
> > MIN Rtmp3,Rb,Rc
> > MAX Rtmp1,Rtmp1,Rtmp2,Rttmp3
> >
> > in that case, for between two and four cycles (assuming that
> > three-way MAX is a single cycle). For OoO, MID is then probably
> > not worth it, especially if it is can not be done in a single
> > cycle.
> >
> > Three-way sort could then be
> >
> > MIN Rmin,Ra,Rb,Rc
> > MAX Rmax,Ra,Rb,Rc
> > MIN Rtmp1,Ra,Rb
> > MIN Rtmp2,Ra,Rc
> > MIN Rtmp3,Rb,Rc
> > MAX Rmid,Rtmp1,Rtmp2,Rttmp3
> >
> > so between two and six cycles.
> The key question is: how often do people sort arrays of numbers?
> My guess is, in fields of signal and image processing they do it not very
> rarely, but also not often. And typical size here is from 2-3 to low hundreds.
>
> In other fields of computing, like commercial, scientific, data analytics,
> sorting arrays of numbers is *extremely* rare.
>
> What is not rare is sorting arrays of records by numeric key.
> Of which most important case is sorting small records consisting of
> numeric key and pointer-or-index.
>
> Max and min instruction are probably far less useful in this mighty
> important case then they are in less important case of sorting arrays of number.

How about double-wide min and max? 1/2 key and 1/2 pointer?

Re: Faster Sort Algorithms

<93e5619a-54b2-485b-8883-79b3c8cb8833n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32824&group=comp.arch#32824

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:6214:14ef:b0:62d:f555:8058 with SMTP id k15-20020a05621414ef00b0062df5558058mr271497qvw.0.1686670809989;
Tue, 13 Jun 2023 08:40:09 -0700 (PDT)
X-Received: by 2002:a05:6830:1247:b0:6af:8244:bb0d with SMTP id
s7-20020a056830124700b006af8244bb0dmr3756407otp.6.1686670809681; Tue, 13 Jun
2023 08:40:09 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!newsfeed.hasname.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Tue, 13 Jun 2023 08:40:09 -0700 (PDT)
In-Reply-To: <u69g9c$300kh$2@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2607:fea8:1dde:6a00:b4f9:2673:e18:71ab;
posting-account=QId4bgoAAABV4s50talpu-qMcPp519Eb
NNTP-Posting-Host: 2607:fea8:1dde:6a00:b4f9:2673:e18:71ab
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<FVlgM.4315$fZx2.2545@fx14.iad> <rPIgM.11831$fZx2.2801@fx14.iad>
<90ea8cc3-2ae8-4401-97a1-f9285e7588c5n@googlegroups.com> <CckhM.10390$NuA9.3884@fx03.iad>
<2023Jun11.163044@mips.complang.tuwien.ac.at> <fce79f80-b4c9-434c-8375-2efead1a637dn@googlegroups.com>
<rkJhM.5473$x7Q8.4240@fx06.iad> <fb1ec155-b47b-4b47-a569-901418d6d6bcn@googlegroups.com>
<u69g9c$300kh$2@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <93e5619a-54b2-485b-8883-79b3c8cb8833n@googlegroups.com>
Subject: Re: Faster Sort Algorithms
From: robfi680@gmail.com (robf...@gmail.com)
Injection-Date: Tue, 13 Jun 2023 15:40:09 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4178
 by: robf...@gmail.com - Tue, 13 Jun 2023 15:40 UTC

On Tuesday, June 13, 2023 at 6:26:55 AM UTC-4, Thomas Koenig wrote:
> robf...@gmail.com <robf...@gmail.com> schrieb:
> > I have been considering using 128-bit bundles containing three
> > 40-bit instructions in fixed locations. That would get back some of the
> > benefits of the 4-byte aligned instructions, but it wastes 6% of memory..
> > The I$ could be made 120-bits wide so no wastage there.
> We previously discussed 128-bit bundles with instructions being
> a multiple of 20 bits, with stop bits in the header.
>
I tried 120-bit bundles, but it makes things more complex than byte
alignment. The bundle must be found on the cache-line, then high order
PC bits used to select the bundle and low order PC bits used to select
the word. There are two multiplies by 120/40 involved. For byte alignment
the low order PC bits can be multiplied by eight. Computing the branch
displacements was a headache when modifying the assembler an extra
byte needed to be inserted every 15 bytes. The bundles also make moving
code around for PIC more challenging.

> Frequent instructions like "add ra,rb,rb" or "add ra,rb,#1" could
> then fall in the 20-bit category.
>
> If you manage 40% of your instructions to use 20 bits and 60% to use
> 40 bits, you break even in code density with a 32-bit encoding.
> But 40 bits are a better fit if you have more than 32 registers.

I think it would be difficult to make good use of 20-bit instructions as
there are 64 GPRs. Most instructions also have predicates and format
fields for vector operations. The 40-bit instruction is packed. I ran out of
registers in the ABI even with 64, as some are used for micro-code. I think
the code density may be less than 20% larger than a 32-bit code as
sometimes 32-bit code needs extra instructions to encode an operation.

> Putting 32-bit or 64-bit constants into the stream is less
> convenient, and will lead to losses in code density vs.,
> for example, Mitch's constant encoding.

Yea, about 20% is lost in code density. Constants are encoded as NOPs
following the instruction. The NOP opcode takes up some space.
>
> You'll need to run a frequency analysis on instructions to see
> if it makes sense for you or not.

With byte aligned code it may be possible to use 24 bit instructions. I had
variable instruction lengths in a previous iteration and it did improve code
density significantly. I guess I am after a faster clock cycle time and less
hardware with this machine.

Re: Faster Sort Algorithms

<13a7a71c-3ca1-4a9a-a7d4-795463519a64n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32828&group=comp.arch#32828

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:622a:1343:b0:3f9:c9d7:38a9 with SMTP id w3-20020a05622a134300b003f9c9d738a9mr3963724qtk.13.1686681015225;
Tue, 13 Jun 2023 11:30:15 -0700 (PDT)
X-Received: by 2002:a05:6870:a886:b0:19f:ad5f:b7e8 with SMTP id
eb6-20020a056870a88600b0019fad5fb7e8mr4205956oab.8.1686681014832; Tue, 13 Jun
2023 11:30:14 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Tue, 13 Jun 2023 11:30:14 -0700 (PDT)
In-Reply-To: <u693iu$2vqpg$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:991b:d366:7e92:932f;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:991b:d366:7e92:932f
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<FVlgM.4315$fZx2.2545@fx14.iad> <rPIgM.11831$fZx2.2801@fx14.iad>
<90ea8cc3-2ae8-4401-97a1-f9285e7588c5n@googlegroups.com> <CckhM.10390$NuA9.3884@fx03.iad>
<2023Jun11.163044@mips.complang.tuwien.ac.at> <6mIhM.58859$d1y5.51140@fx17.iad>
<u681a9$2v4pe$1@newsreader4.netcologne.de> <d8406fa3-b88e-4ba5-885e-ed03b3cdd1b6n@googlegroups.com>
<u693iu$2vqpg$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <13a7a71c-3ca1-4a9a-a7d4-795463519a64n@googlegroups.com>
Subject: Re: Faster Sort Algorithms
From: MitchAlsup@aol.com (MitchAlsup)
Injection-Date: Tue, 13 Jun 2023 18:30:15 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4274
 by: MitchAlsup - Tue, 13 Jun 2023 18:30 UTC

On Tuesday, June 13, 2023 at 1:50:10 AM UTC-5, Thomas Koenig wrote:
> MitchAlsup <Mitch...@aol.com> schrieb:
> > On Monday, June 12, 2023 at 4:05:16 PM UTC-5, Thomas Koenig wrote:
> >> Hmm.. a couple of thoughts.
> >>
> >> Assumme we have the three-operand instructions
> >>
> >> MIN Rt,Ra,Rb,Rc
> >> MID Rt,Ra,Rb,Rc
> >> MAX Rt,Ra,Rb,Rc
> ><
> > In the 1980s and very early '90s, some designers thought about using
> > CAM sort arrays* in hardware. Software would load up a number of
> > values and write them into the "sorter", after loading all values, soft-
> > ware would read out all the value in order. No instruction was needed
> > to cause the sorter to sort, the writing of values in performed sorting..
> ><
> > These never went anywhere--draw your own conclusions.
> The pendulum of reintegration swung the other way, quickly.
>
> Although there appears to be a SORTL instruction on zSystem, according to
> https://blog.share.org/Article/peeking-under-the-hood-of-sort-acceleration-on-z15
> which appears to bring some improvement, so...
> ><
> > (*) CAMs can be made to do things other than exact match detection.
> Interesting.
>
> MIN and MAX of three registers is straightforward two instructions,
> but MID is more challenging. It could be something like
>
> MIN Rtmp1,Ra,Rb
> MIN Rtmp2,Ra,Rc
> MIN Rtmp3,Rb,Rc
> MAX Rtmp1,Rt1,Rt2
> MAX Rtmp1,Rt1,Rt3
<
Hardware could perform 3 comparisons in parallel A CMP B, A CMP C,
and B CMP C. Then using the > and < indications from the 3 comparisons
perform::
<
SRT3 {Ra, Rb, Rc} > {Ra, Rb, Rc}
<
In one pass through a 2 cycle pipeline. Latency = 2 throughput = 1.
By reusing the register names fewer fields are required in the instruction.
>
> with (assuming single-cycle latency) anything between three
> (for a sufficiently wide OoO machine) and five cycles of latency.
>
> The last two instructions would be a three-way MAX, so this
> could be shortened to
>
> MIN Rtmp1,Ra,Rb
> MIN Rtmp2,Ra,Rc
> MIN Rtmp3,Rb,Rc
> MAX Rtmp1,Rtmp1,Rtmp2,Rttmp3
>
> in that case, for between two and four cycles (assuming that
> three-way MAX is a single cycle). For OoO, MID is then probably
> not worth it, especially if it is can not be done in a single
> cycle.
>
> Three-way sort could then be
>
> MIN Rmin,Ra,Rb,Rc
> MAX Rmax,Ra,Rb,Rc
> MIN Rtmp1,Ra,Rb
> MIN Rtmp2,Ra,Rc
> MIN Rtmp3,Rb,Rc
> MAX Rmid,Rtmp1,Rtmp2,Rttmp3
>
> so between two and six cycles.

Re: Faster Sort Algorithms

<23eefa93-910e-4700-be16-fc89e43bcc6an@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32829&group=comp.arch#32829

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:622a:189f:b0:3f6:b052:3431 with SMTP id v31-20020a05622a189f00b003f6b0523431mr4496523qtc.5.1686681239578;
Tue, 13 Jun 2023 11:33:59 -0700 (PDT)
X-Received: by 2002:aca:3d07:0:b0:39c:872c:9399 with SMTP id
k7-20020aca3d07000000b0039c872c9399mr1933768oia.4.1686681239279; Tue, 13 Jun
2023 11:33:59 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Tue, 13 Jun 2023 11:33:59 -0700 (PDT)
In-Reply-To: <u69fjl$300kh$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:991b:d366:7e92:932f;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:991b:d366:7e92:932f
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<FVlgM.4315$fZx2.2545@fx14.iad> <rPIgM.11831$fZx2.2801@fx14.iad>
<90ea8cc3-2ae8-4401-97a1-f9285e7588c5n@googlegroups.com> <CckhM.10390$NuA9.3884@fx03.iad>
<2023Jun11.163044@mips.complang.tuwien.ac.at> <6mIhM.58859$d1y5.51140@fx17.iad>
<u681a9$2v4pe$1@newsreader4.netcologne.de> <5UMhM.36287$fZx2.13431@fx14.iad>
<92f105ce-b9d9-4779-b0f3-9400509af7adn@googlegroups.com> <u69fjl$300kh$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <23eefa93-910e-4700-be16-fc89e43bcc6an@googlegroups.com>
Subject: Re: Faster Sort Algorithms
From: MitchAlsup@aol.com (MitchAlsup)
Injection-Date: Tue, 13 Jun 2023 18:33:59 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2326
 by: MitchAlsup - Tue, 13 Jun 2023 18:33 UTC

On Tuesday, June 13, 2023 at 5:15:20 AM UTC-5, Thomas Koenig wrote:
> MitchAlsup <Mitch...@aol.com> schrieb:
> > Many sort algorithms allow the user to supply the subroutine that determines
> > the sort order::
> ><
> > SORT( A, length, comparison )
> > {
> > for( j = 0; j < length-1; j++ )
> > for( i = 0; I < length; i++ )
> > if( comparison( A[i], A[j] )
> > SWAP( A[i], A[j] );
> > }
> An argument for either templates or LTO if there ever was one.
> Making a function call to compare two integers or floats sounds
> wrong, however low the overhead may be.
<
What about EBCIDIC strings ??
What about ASCII strings ??
What about UTF8 strings ??

Re: Faster Sort Algorithms

<u6ago1$3mmpl$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32834&group=comp.arch#32834

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: terje.mathisen@tmsw.no (Terje Mathisen)
Newsgroups: comp.arch
Subject: Re: Faster Sort Algorithms
Date: Tue, 13 Jun 2023 21:40:49 +0200
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <u6ago1$3mmpl$1@dont-email.me>
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<FVlgM.4315$fZx2.2545@fx14.iad> <rPIgM.11831$fZx2.2801@fx14.iad>
<90ea8cc3-2ae8-4401-97a1-f9285e7588c5n@googlegroups.com>
<CckhM.10390$NuA9.3884@fx03.iad>
<2023Jun11.163044@mips.complang.tuwien.ac.at>
<6mIhM.58859$d1y5.51140@fx17.iad> <u681a9$2v4pe$1@newsreader4.netcologne.de>
<5UMhM.36287$fZx2.13431@fx14.iad>
<92f105ce-b9d9-4779-b0f3-9400509af7adn@googlegroups.com>
<u69fjl$300kh$1@newsreader4.netcologne.de>
<23eefa93-910e-4700-be16-fc89e43bcc6an@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 13 Jun 2023 19:40:49 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3b364792274804d5bbe8f882351abd6b";
logging-data="3889973"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19htNsWn9T6JNVWraOuGPjf5D05arHqLihSuTUHJY7Xsw=="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.16
Cancel-Lock: sha1:eGGI8aUf5Nn5GIAspfJGSQjhluQ=
In-Reply-To: <23eefa93-910e-4700-be16-fc89e43bcc6an@googlegroups.com>
 by: Terje Mathisen - Tue, 13 Jun 2023 19:40 UTC

MitchAlsup wrote:
> On Tuesday, June 13, 2023 at 5:15:20 AM UTC-5, Thomas Koenig wrote:
>> MitchAlsup <Mitch...@aol.com> schrieb:
>>> Many sort algorithms allow the user to supply the subroutine that determines
>>> the sort order::
>>> <
>>> SORT( A, length, comparison )
>>> {
>>> for( j = 0; j < length-1; j++ )
>>> for( i = 0; I < length; i++ )
>>> if( comparison( A[i], A[j] )
>>> SWAP( A[i], A[j] );
>>> }
>> An argument for either templates or LTO if there ever was one.
>> Making a function call to compare two integers or floats sounds
>> wrong, however low the overhead may be.
> <
> What about EBCIDIC strings ??
> What about ASCII strings ??
> What about UTF8 strings ??

I am guessing that the fastest approach might be similar to the C
single-byte file read call, which is actually a macro that picks the
next byte from the file buffer, only falling back to an actual function
call when the buffer is empty.

You probably need some C++ template magic to make this all work
semi-portably across multiple record key types?

I remember writing sort code 35+ years ago that would extract and
serialize all the keys, together with a record index, so that the
comparison function could always use an inline REPE CMPSB. This meant
that some types of sub-key parts needed to be inverted or negated in
order to get the desired sort direction, but this way I only did all
this once per record instead of twice for every pair comparison.

Terje

--
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

Re: Faster Sort Algorithms

<8da63a3a-84eb-496f-ab7f-cafed95efe51n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32836&group=comp.arch#32836

  copy link   Newsgroups: comp.arch
X-Received: by 2002:ad4:4bac:0:b0:5ef:5726:ba25 with SMTP id i12-20020ad44bac000000b005ef5726ba25mr1652309qvw.0.1686685929044;
Tue, 13 Jun 2023 12:52:09 -0700 (PDT)
X-Received: by 2002:aca:db42:0:b0:39c:cd8e:9996 with SMTP id
s63-20020acadb42000000b0039ccd8e9996mr2374648oig.0.1686685928675; Tue, 13 Jun
2023 12:52:08 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!tncsrv06.tnetconsulting.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Tue, 13 Jun 2023 12:52:08 -0700 (PDT)
In-Reply-To: <857761a7-a108-495e-a6cc-b0fa424adb76n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a0d:6fc2:55b0:ca00:9441:c7b9:3da5:7e93;
posting-account=ow8VOgoAAAAfiGNvoH__Y4ADRwQF1hZW
NNTP-Posting-Host: 2a0d:6fc2:55b0:ca00:9441:c7b9:3da5:7e93
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<FVlgM.4315$fZx2.2545@fx14.iad> <rPIgM.11831$fZx2.2801@fx14.iad>
<90ea8cc3-2ae8-4401-97a1-f9285e7588c5n@googlegroups.com> <CckhM.10390$NuA9.3884@fx03.iad>
<2023Jun11.163044@mips.complang.tuwien.ac.at> <6mIhM.58859$d1y5.51140@fx17.iad>
<u681a9$2v4pe$1@newsreader4.netcologne.de> <d8406fa3-b88e-4ba5-885e-ed03b3cdd1b6n@googlegroups.com>
<u693iu$2vqpg$1@newsreader4.netcologne.de> <6c5d66c2-8014-4f87-aa09-2470fc6bb044n@googlegroups.com>
<857761a7-a108-495e-a6cc-b0fa424adb76n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8da63a3a-84eb-496f-ab7f-cafed95efe51n@googlegroups.com>
Subject: Re: Faster Sort Algorithms
From: already5chosen@yahoo.com (Michael S)
Injection-Date: Tue, 13 Jun 2023 19:52:09 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 6370
 by: Michael S - Tue, 13 Jun 2023 19:52 UTC

On Tuesday, June 13, 2023 at 6:10:13 PM UTC+3, robf...@gmail.com wrote:
> On Tuesday, June 13, 2023 at 8:30:27 AM UTC-4, Michael S wrote:
> > On Tuesday, June 13, 2023 at 9:50:10 AM UTC+3, Thomas Koenig wrote:
> > > MitchAlsup <Mitch...@aol.com> schrieb:
> > > > On Monday, June 12, 2023 at 4:05:16 PM UTC-5, Thomas Koenig wrote:
> > > >> Hmm.. a couple of thoughts.
> > > >>
> > > >> Assumme we have the three-operand instructions
> > > >>
> > > >> MIN Rt,Ra,Rb,Rc
> > > >> MID Rt,Ra,Rb,Rc
> > > >> MAX Rt,Ra,Rb,Rc
> > > ><
> > > > In the 1980s and very early '90s, some designers thought about using
> > > > CAM sort arrays* in hardware. Software would load up a number of
> > > > values and write them into the "sorter", after loading all values, soft-
> > > > ware would read out all the value in order. No instruction was needed
> > > > to cause the sorter to sort, the writing of values in performed sorting.
> > > ><
> > > > These never went anywhere--draw your own conclusions.
> > > The pendulum of reintegration swung the other way, quickly.
> > >
> > > Although there appears to be a SORTL instruction on zSystem, according to
> > > https://blog.share.org/Article/peeking-under-the-hood-of-sort-acceleration-on-z15
> > > which appears to bring some improvement, so...
> > > ><
> > > > (*) CAMs can be made to do things other than exact match detection.
> > > Interesting.
> > >
> > > MIN and MAX of three registers is straightforward two instructions,
> > > but MID is more challenging. It could be something like
> > >
> > > MIN Rtmp1,Ra,Rb
> > > MIN Rtmp2,Ra,Rc
> > > MIN Rtmp3,Rb,Rc
> > > MAX Rtmp1,Rt1,Rt2
> > > MAX Rtmp1,Rt1,Rt3
> > >
> > > with (assuming single-cycle latency) anything between three
> > > (for a sufficiently wide OoO machine) and five cycles of latency.
> > >
> > > The last two instructions would be a three-way MAX, so this
> > > could be shortened to
> > >
> > > MIN Rtmp1,Ra,Rb
> > > MIN Rtmp2,Ra,Rc
> > > MIN Rtmp3,Rb,Rc
> > > MAX Rtmp1,Rtmp1,Rtmp2,Rttmp3
> > >
> > > in that case, for between two and four cycles (assuming that
> > > three-way MAX is a single cycle). For OoO, MID is then probably
> > > not worth it, especially if it is can not be done in a single
> > > cycle.
> > >
> > > Three-way sort could then be
> > >
> > > MIN Rmin,Ra,Rb,Rc
> > > MAX Rmax,Ra,Rb,Rc
> > > MIN Rtmp1,Ra,Rb
> > > MIN Rtmp2,Ra,Rc
> > > MIN Rtmp3,Rb,Rc
> > > MAX Rmid,Rtmp1,Rtmp2,Rttmp3
> > >
> > > so between two and six cycles.
> > The key question is: how often do people sort arrays of numbers?
> > My guess is, in fields of signal and image processing they do it not very
> > rarely, but also not often. And typical size here is from 2-3 to low hundreds.
> >
> > In other fields of computing, like commercial, scientific, data analytics,
> > sorting arrays of numbers is *extremely* rare.
> >
> > What is not rare is sorting arrays of records by numeric key.
> > Of which most important case is sorting small records consisting of
> > numeric key and pointer-or-index.
> >
> > Max and min instruction are probably far less useful in this mighty
> > important case then they are in less important case of sorting arrays of number.
> How about double-wide min and max? 1/2 key and 1/2 pointer?

On the GPR side or on the SIMD side, assuming that your machine has SIMD side
in the first place.

On GPR side:
Such instruction, apart from complexity of implementation, is going to require twice
as many rename resources vs "normal" instruction, so good implementation will likely
make it half the throughout of "normal" instructions. So, the whole enterprise of replacing
1 compare + 4 conditional moves with Min2 + Max2 will improve performance by 20%.
I don't find it very attractive.

On SIMD side.
For 128-bit SIMD - great idea. Very easy to implement. Flexible and useful.

For wider SIMD - how do you define it? There are two options:

A. Keys are in lower 64 bits (or 32 bits). The rest of register is payload..

B. Each 128-bit superlane has the key of its own, so for 512b register you do
4 independent Min2 or Max2 operations at once.

I don't know which option is more useful in practice. I do know however that
option A is much harder to implement in hardware than optiion B.

Re: Faster Sort Algorithms

<u6aie4$guk$1@gal.iecc.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32837&group=comp.arch#32837

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.cmpublishers.com!adore2!news.iecc.com!.POSTED.news.iecc.com!not-for-mail
From: johnl@taugh.com (John Levine)
Newsgroups: comp.arch
Subject: Re: Faster Sort Algorithms
Date: Tue, 13 Jun 2023 20:09:40 -0000 (UTC)
Organization: Taughannock Networks
Message-ID: <u6aie4$guk$1@gal.iecc.com>
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com> <92f105ce-b9d9-4779-b0f3-9400509af7adn@googlegroups.com> <u69fjl$300kh$1@newsreader4.netcologne.de> <23eefa93-910e-4700-be16-fc89e43bcc6an@googlegroups.com>
Injection-Date: Tue, 13 Jun 2023 20:09:40 -0000 (UTC)
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970";
logging-data="17364"; mail-complaints-to="abuse@iecc.com"
In-Reply-To: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com> <92f105ce-b9d9-4779-b0f3-9400509af7adn@googlegroups.com> <u69fjl$300kh$1@newsreader4.netcologne.de> <23eefa93-910e-4700-be16-fc89e43bcc6an@googlegroups.com>
Cleverness: some
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: johnl@iecc.com (John Levine)
 by: John Levine - Tue, 13 Jun 2023 20:09 UTC

According to MitchAlsup <MitchAlsup@aol.com>:
>On Tuesday, June 13, 2023 at 5:15:20 AM UTC-5, Thomas Koenig wrote:
>> MitchAlsup <Mitch...@aol.com> schrieb:
>> > Many sort algorithms allow the user to supply the subroutine that determines
>> > the sort order::
>> ><
>> > SORT( A, length, comparison )
>> > {
>> > for( j = 0; j < length-1; j++ )
>> > for( i = 0; I < length; i++ )
>> > if( comparison( A[i], A[j] )
>> > SWAP( A[i], A[j] );
>> > }
>> An argument for either templates or LTO if there ever was one.
>> Making a function call to compare two integers or floats sounds
>> wrong, however low the overhead may be.
><
>What about EBCIDIC strings ??
>What about ASCII strings ??
>What about UTF8 strings ??

On the systems I know, the sort routine treats the data as a set of
byte strings, and the default comparison is a string compare.

Not entirely by accident, this gives a reasonable answer if the string
is EBCDIC, ASCII, or UTF-8. Digits sort in 0-9 order and alphabetics
sort reasonably. Sorting UTF-8 gives the same order as if you decoded
them to code points and sorted them.
--
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly

Re: Faster Sort Algorithms

<cA4iM.19344$F2qf.810@fx48.iad>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32838&group=comp.arch#32838

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx48.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: scott@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Faster Sort Algorithms
Newsgroups: comp.arch
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com> <92f105ce-b9d9-4779-b0f3-9400509af7adn@googlegroups.com> <u69fjl$300kh$1@newsreader4.netcologne.de> <23eefa93-910e-4700-be16-fc89e43bcc6an@googlegroups.com> <u6aie4$guk$1@gal.iecc.com>
Lines: 34
Message-ID: <cA4iM.19344$F2qf.810@fx48.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Tue, 13 Jun 2023 20:46:00 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Tue, 13 Jun 2023 20:46:00 GMT
X-Received-Bytes: 2218
 by: Scott Lurndal - Tue, 13 Jun 2023 20:46 UTC

John Levine <johnl@taugh.com> writes:
>According to MitchAlsup <MitchAlsup@aol.com>:
>>On Tuesday, June 13, 2023 at 5:15:20 AM UTC-5, Thomas Koenig wrote:
>>> MitchAlsup <Mitch...@aol.com> schrieb:
>>> > Many sort algorithms allow the user to supply the subroutine that determines
>>> > the sort order::
>>> ><
>>> > SORT( A, length, comparison )
>>> > {
>>> > for( j = 0; j < length-1; j++ )
>>> > for( i = 0; I < length; i++ )
>>> > if( comparison( A[i], A[j] )
>>> > SWAP( A[i], A[j] );
>>> > }
>>> An argument for either templates or LTO if there ever was one.
>>> Making a function call to compare two integers or floats sounds
>>> wrong, however low the overhead may be.
>><
>>What about EBCIDIC strings ??
>>What about ASCII strings ??
>>What about UTF8 strings ??
>
>On the systems I know, the sort routine treats the data as a set of
>byte strings, and the default comparison is a string compare.
>
>Not entirely by accident, this gives a reasonable answer if the string
>is EBCDIC, ASCII, or UTF-8. Digits sort in 0-9 order and alphabetics
>sort reasonably. Sorting UTF-8 gives the same order as if you decoded
>them to code points and sorted them.

One key difference - in ASCII digits collate before all alpha characters;
the reverse is true for EBCDIC causing a different sort order for
alphanumeric keys.

Re: Faster Sort Algorithms

<u6kv0r$37f7m$1@newsreader4.netcologne.de>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32863&group=comp.arch#32863

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!.POSTED.2001-4dd7-5290-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de!not-for-mail
From: tkoenig@netcologne.de (Thomas Koenig)
Newsgroups: comp.arch
Subject: Re: Faster Sort Algorithms
Date: Sat, 17 Jun 2023 18:45:47 -0000 (UTC)
Organization: news.netcologne.de
Distribution: world
Message-ID: <u6kv0r$37f7m$1@newsreader4.netcologne.de>
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<FVlgM.4315$fZx2.2545@fx14.iad> <rPIgM.11831$fZx2.2801@fx14.iad>
<90ea8cc3-2ae8-4401-97a1-f9285e7588c5n@googlegroups.com>
<CckhM.10390$NuA9.3884@fx03.iad>
<2023Jun11.163044@mips.complang.tuwien.ac.at>
<6mIhM.58859$d1y5.51140@fx17.iad>
<u681a9$2v4pe$1@newsreader4.netcologne.de>
<d8406fa3-b88e-4ba5-885e-ed03b3cdd1b6n@googlegroups.com>
<u693iu$2vqpg$1@newsreader4.netcologne.de>
<13a7a71c-3ca1-4a9a-a7d4-795463519a64n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 17 Jun 2023 18:45:47 -0000 (UTC)
Injection-Info: newsreader4.netcologne.de; posting-host="2001-4dd7-5290-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de:2001:4dd7:5290:0:7285:c2ff:fe6c:992d";
logging-data="3390710"; mail-complaints-to="abuse@netcologne.de"
User-Agent: slrn/1.0.3 (Linux)
 by: Thomas Koenig - Sat, 17 Jun 2023 18:45 UTC

MitchAlsup <MitchAlsup@aol.com> schrieb:
> On Tuesday, June 13, 2023 at 1:50:10 AM UTC-5, Thomas Koenig wrote:
>> MitchAlsup <Mitch...@aol.com> schrieb:
>> > On Monday, June 12, 2023 at 4:05:16 PM UTC-5, Thomas Koenig wrote:
>> >> Hmm.. a couple of thoughts.
>> >>
>> >> Assumme we have the three-operand instructions
>> >>
>> >> MIN Rt,Ra,Rb,Rc
>> >> MID Rt,Ra,Rb,Rc
>> >> MAX Rt,Ra,Rb,Rc
>> ><
>> > In the 1980s and very early '90s, some designers thought about using
>> > CAM sort arrays* in hardware. Software would load up a number of
>> > values and write them into the "sorter", after loading all values, soft-
>> > ware would read out all the value in order. No instruction was needed
>> > to cause the sorter to sort, the writing of values in performed sorting.
>> ><
>> > These never went anywhere--draw your own conclusions.
>> The pendulum of reintegration swung the other way, quickly.
>>
>> Although there appears to be a SORTL instruction on zSystem, according to
>> https://blog.share.org/Article/peeking-under-the-hood-of-sort-acceleration-on-z15
>> which appears to bring some improvement, so...
>> ><
>> > (*) CAMs can be made to do things other than exact match detection.
>> Interesting.
>>
>> MIN and MAX of three registers is straightforward two instructions,
>> but MID is more challenging. It could be something like
>>
>> MIN Rtmp1,Ra,Rb
>> MIN Rtmp2,Ra,Rc
>> MIN Rtmp3,Rb,Rc
>> MAX Rtmp1,Rt1,Rt2
>> MAX Rtmp1,Rt1,Rt3
><
> Hardware could perform 3 comparisons in parallel A CMP B, A CMP C,
> and B CMP C. Then using the > and < indications from the 3 comparisons
> perform::
><
> SRT3 {Ra, Rb, Rc} > {Ra, Rb, Rc}
><
> In one pass through a 2 cycle pipeline. Latency = 2 throughput = 1.
> By reusing the register names fewer fields are required in the instruction.

To do this in two cyles would this require writing three registers
at the same time (so at least a 3R3W register file), correct?
Or is there some way of making this less expensive?

It might actually make sense to split this into two instructions for
more flexibility, to make both direct and index sort possible.

So something like

CMP3GT Rt,Rs1,Rs2,Rs3
SRT3 Rt,Ra,Rb,Rc

where CMP3GT could generate a bit pattern indicating which way
the target registers of SRT3 should be swapped (for example 010
001 100 if the value of Ra should be moved into Rb, the value of
Rb into Ra and the value of Rc should be left unchanged).

Re: Faster Sort Algorithms

<f7300d6f-63de-4775-925d-21645857ef86n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32865&group=comp.arch#32865

  copy link   Newsgroups: comp.arch
X-Received: by 2002:ac8:578a:0:b0:3f8:465:239d with SMTP id v10-20020ac8578a000000b003f80465239dmr2410603qta.1.1687028496422;
Sat, 17 Jun 2023 12:01:36 -0700 (PDT)
X-Received: by 2002:a05:6870:d88b:b0:1a6:a381:fb3d with SMTP id
dv11-20020a056870d88b00b001a6a381fb3dmr483858oab.10.1687028496121; Sat, 17
Jun 2023 12:01:36 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Sat, 17 Jun 2023 12:01:35 -0700 (PDT)
In-Reply-To: <u6kv0r$37f7m$1@newsreader4.netcologne.de>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:40fa:1219:e296:e8f7;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:40fa:1219:e296:e8f7
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<FVlgM.4315$fZx2.2545@fx14.iad> <rPIgM.11831$fZx2.2801@fx14.iad>
<90ea8cc3-2ae8-4401-97a1-f9285e7588c5n@googlegroups.com> <CckhM.10390$NuA9.3884@fx03.iad>
<2023Jun11.163044@mips.complang.tuwien.ac.at> <6mIhM.58859$d1y5.51140@fx17.iad>
<u681a9$2v4pe$1@newsreader4.netcologne.de> <d8406fa3-b88e-4ba5-885e-ed03b3cdd1b6n@googlegroups.com>
<u693iu$2vqpg$1@newsreader4.netcologne.de> <13a7a71c-3ca1-4a9a-a7d4-795463519a64n@googlegroups.com>
<u6kv0r$37f7m$1@newsreader4.netcologne.de>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f7300d6f-63de-4775-925d-21645857ef86n@googlegroups.com>
Subject: Re: Faster Sort Algorithms
From: MitchAlsup@aol.com (MitchAlsup)
Injection-Date: Sat, 17 Jun 2023 19:01:36 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4778
 by: MitchAlsup - Sat, 17 Jun 2023 19:01 UTC

On Saturday, June 17, 2023 at 1:45:51 PM UTC-5, Thomas Koenig wrote:
> MitchAlsup <Mitch...@aol.com> schrieb:
> > On Tuesday, June 13, 2023 at 1:50:10 AM UTC-5, Thomas Koenig wrote:
> >> MitchAlsup <Mitch...@aol.com> schrieb:
> >> > On Monday, June 12, 2023 at 4:05:16 PM UTC-5, Thomas Koenig wrote:
> >> >> Hmm.. a couple of thoughts.
> >> >>
> >> >> Assumme we have the three-operand instructions
> >> >>
> >> >> MIN Rt,Ra,Rb,Rc
> >> >> MID Rt,Ra,Rb,Rc
> >> >> MAX Rt,Ra,Rb,Rc
> >> ><
> >> > In the 1980s and very early '90s, some designers thought about using
> >> > CAM sort arrays* in hardware. Software would load up a number of
> >> > values and write them into the "sorter", after loading all values, soft-
> >> > ware would read out all the value in order. No instruction was needed
> >> > to cause the sorter to sort, the writing of values in performed sorting.
> >> ><
> >> > These never went anywhere--draw your own conclusions.
> >> The pendulum of reintegration swung the other way, quickly.
> >>
> >> Although there appears to be a SORTL instruction on zSystem, according to
> >> https://blog.share.org/Article/peeking-under-the-hood-of-sort-acceleration-on-z15
> >> which appears to bring some improvement, so...
> >> ><
> >> > (*) CAMs can be made to do things other than exact match detection.
> >> Interesting.
> >>
> >> MIN and MAX of three registers is straightforward two instructions,
> >> but MID is more challenging. It could be something like
> >>
> >> MIN Rtmp1,Ra,Rb
> >> MIN Rtmp2,Ra,Rc
> >> MIN Rtmp3,Rb,Rc
> >> MAX Rtmp1,Rt1,Rt2
> >> MAX Rtmp1,Rt1,Rt3
> ><
> > Hardware could perform 3 comparisons in parallel A CMP B, A CMP C,
> > and B CMP C. Then using the > and < indications from the 3 comparisons
> > perform::
> ><
> > SRT3 {Ra, Rb, Rc} > {Ra, Rb, Rc}
> ><
> > In one pass through a 2 cycle pipeline. Latency = 2 throughput = 1.
> > By reusing the register names fewer fields are required in the instruction.
> To do this in two cyles would this require writing three registers
> at the same time (so at least a 3R3W register file), correct?
<
Yes, that is the implication of throughput = 1
<
> Or is there some way of making this less expensive?
<
There are ways if you have access to raw transistors and wires. It gets
expensive fast if you only have access to gates from a library.
>
> It might actually make sense to split this into two instructions for
> more flexibility, to make both direct and index sort possible.
>
> So something like
>
> CMP3GT Rt,Rs1,Rs2,Rs3
> SRT3 Rt,Ra,Rb,Rc
>
> where CMP3GT could generate a bit pattern indicating which way
> the target registers of SRT3 should be swapped (for example 010
> 001 100 if the value of Ra should be moved into Rb, the value of
> Rb into Ra and the value of Rc should be left unchanged).

Re: Faster Sort Algorithms

<560b9f97-fa0c-4cd9-b176-c9ab052cb3cfn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32867&group=comp.arch#32867

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:620a:38c5:b0:762:5014:ad7e with SMTP id qq5-20020a05620a38c500b007625014ad7emr1206857qkn.11.1687185331289;
Mon, 19 Jun 2023 07:35:31 -0700 (PDT)
X-Received: by 2002:a05:6870:1a91:b0:1a6:98de:e45c with SMTP id
ef17-20020a0568701a9100b001a698dee45cmr1806754oab.5.1687185330914; Mon, 19
Jun 2023 07:35:30 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Mon, 19 Jun 2023 07:35:30 -0700 (PDT)
In-Reply-To: <cA4iM.19344$F2qf.810@fx48.iad>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:387:f:641c:0:0:0:7;
posting-account=_zXfWQoAAAB4RAD8sxfcL-jV_TJhiDJH
NNTP-Posting-Host: 2600:387:f:641c:0:0:0:7
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<92f105ce-b9d9-4779-b0f3-9400509af7adn@googlegroups.com> <u69fjl$300kh$1@newsreader4.netcologne.de>
<23eefa93-910e-4700-be16-fc89e43bcc6an@googlegroups.com> <u6aie4$guk$1@gal.iecc.com>
<cA4iM.19344$F2qf.810@fx48.iad>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <560b9f97-fa0c-4cd9-b176-c9ab052cb3cfn@googlegroups.com>
Subject: Re: Faster Sort Algorithms
From: cr88192@gmail.com (BGB)
Injection-Date: Mon, 19 Jun 2023 14:35:31 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3431
 by: BGB - Mon, 19 Jun 2023 14:35 UTC

On Tuesday, June 13, 2023 at 3:46:04 PM UTC-5, Scott Lurndal wrote:
> John Levine <jo...@taugh.com> writes:
> >According to MitchAlsup <Mitch...@aol.com>:
> >>On Tuesday, June 13, 2023 at 5:15:20 AM UTC-5, Thomas Koenig wrote:
> >>> MitchAlsup <Mitch...@aol.com> schrieb:
> >>> > Many sort algorithms allow the user to supply the subroutine that determines
> >>> > the sort order::
> >>> ><
> >>> > SORT( A, length, comparison )
> >>> > {
> >>> > for( j = 0; j < length-1; j++ )
> >>> > for( i = 0; I < length; i++ )
> >>> > if( comparison( A[i], A[j] )
> >>> > SWAP( A[i], A[j] );
> >>> > }
> >>> An argument for either templates or LTO if there ever was one.
> >>> Making a function call to compare two integers or floats sounds
> >>> wrong, however low the overhead may be.
> >><
> >>What about EBCIDIC strings ??
> >>What about ASCII strings ??
> >>What about UTF8 strings ??
> >
> >On the systems I know, the sort routine treats the data as a set of
> >byte strings, and the default comparison is a string compare.
> >
> >Not entirely by accident, this gives a reasonable answer if the string
> >is EBCDIC, ASCII, or UTF-8. Digits sort in 0-9 order and alphabetics
> >sort reasonably. Sorting UTF-8 gives the same order as if you decoded
> >them to code points and sorted them.
> One key difference - in ASCII digits collate before all alpha characters;
> the reverse is true for EBCDIC causing a different sort order for
> alphanumeric keys.

Though, stricmp/strnicmp is more of a problem:
ASCII: Easy enough.
1252: Also works, just needs more rules.
UTF-8: Simple case: ASCII only. Non-simple case, "Oh No".

Woud need different implementations to support both 1252 and UTF-8 and give sensible results...

But, any progress on my projects is currently stalled at the moment due to being in the middle of a multi-day blackout... (posting from phone, with an intermittent connection).

Re: Faster Sort Algorithms

<u6q6j3$2qs0$1@gal.iecc.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32869&group=comp.arch#32869

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.cmpublishers.com!adore2!news.iecc.com!.POSTED.news.iecc.com!not-for-mail
From: johnl@taugh.com (John Levine)
Newsgroups: comp.arch
Subject: Re: Faster Sort Algorithms
Date: Mon, 19 Jun 2023 18:25:39 -0000 (UTC)
Organization: Taughannock Networks
Message-ID: <u6q6j3$2qs0$1@gal.iecc.com>
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com> <u6aie4$guk$1@gal.iecc.com> <cA4iM.19344$F2qf.810@fx48.iad> <560b9f97-fa0c-4cd9-b176-c9ab052cb3cfn@googlegroups.com>
Injection-Date: Mon, 19 Jun 2023 18:25:39 -0000 (UTC)
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970";
logging-data="93056"; mail-complaints-to="abuse@iecc.com"
In-Reply-To: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com> <u6aie4$guk$1@gal.iecc.com> <cA4iM.19344$F2qf.810@fx48.iad> <560b9f97-fa0c-4cd9-b176-c9ab052cb3cfn@googlegroups.com>
Cleverness: some
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: johnl@iecc.com (John Levine)
 by: John Levine - Mon, 19 Jun 2023 18:25 UTC

According to BGB <cr88192@gmail.com>:
>> >sort reasonably. Sorting UTF-8 gives the same order as if you decoded
>> >them to code points and sorted them.

>Though, stricmp/strnicmp is more of a problem:
>ASCII: Easy enough.
>1252: Also works, just needs more rules.
>UTF-8: Simple case: ASCII only. Non-simple case, "Oh No".
>
>Woud need different implementations to support both 1252 and UTF-8 and give sensible results...

What's not sensible about sorting UTF-8 into code point order?

If you want a sort order that matches a language's dictionary order,
that's much harder, but it's not trivial in ASCII, either.

--
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly

Re: Faster Sort Algorithms

<4e653611-2eef-4eb2-924f-09c642228108n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32870&group=comp.arch#32870

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:622a:1822:b0:3ef:8159:5ec4 with SMTP id t34-20020a05622a182200b003ef81595ec4mr4662679qtc.9.1687204534128;
Mon, 19 Jun 2023 12:55:34 -0700 (PDT)
X-Received: by 2002:a05:6870:d88f:b0:1a2:72ae:8438 with SMTP id
dv15-20020a056870d88f00b001a272ae8438mr1867999oab.11.1687204533826; Mon, 19
Jun 2023 12:55:33 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Mon, 19 Jun 2023 12:55:33 -0700 (PDT)
In-Reply-To: <u6q6j3$2qs0$1@gal.iecc.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:387:f:641c:0:0:0:7;
posting-account=_zXfWQoAAAB4RAD8sxfcL-jV_TJhiDJH
NNTP-Posting-Host: 2600:387:f:641c:0:0:0:7
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<u6aie4$guk$1@gal.iecc.com> <cA4iM.19344$F2qf.810@fx48.iad>
<560b9f97-fa0c-4cd9-b176-c9ab052cb3cfn@googlegroups.com> <u6q6j3$2qs0$1@gal.iecc.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4e653611-2eef-4eb2-924f-09c642228108n@googlegroups.com>
Subject: Re: Faster Sort Algorithms
From: cr88192@gmail.com (BGB)
Injection-Date: Mon, 19 Jun 2023 19:55:34 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3578
 by: BGB - Mon, 19 Jun 2023 19:55 UTC

On Monday, June 19, 2023 at 1:25:43 PM UTC-5, John Levine wrote:
> According to BGB <cr8...@gmail.com>:
> >> >sort reasonably. Sorting UTF-8 gives the same order as if you decoded
> >> >them to code points and sorted them.
> >Though, stricmp/strnicmp is more of a problem:
> >ASCII: Easy enough.
> >1252: Also works, just needs more rules.
> >UTF-8: Simple case: ASCII only. Non-simple case, "Oh No".
> >
> >Woud need different implementations to support both 1252 and UTF-8 and give sensible results...
> What's not sensible about sorting UTF-8 into code point order?
>

The stricmp/strnicmp (AKA: strcasecmp/strncasecmp or _stricmp/_strnicmp) functions do a case-insensitive compare.

This requires internally normalizing the case, which requires knowing the character encoding (if, say, the Latin1 characters are also intended to be case-insensitive).

I am not sure what the "standard" solution is though (the descriptions I had found make no reference to locale or character encoding).

Or, one could make a case that these functions only apply to ASCII (and/or 1252) and have separate "_stricmp_u8" functions and similar?...

> If you want a sort order that matches a language's dictionary order,
> that's much harder, but it's not trivial in ASCII, either.

Granted, but easy enough to define 'A' == 'a' for sake of case-insensitive compare, and ignore others.

Then there are the accented characters, which are mostly a matter of mapping.

The German "hard S" character has no obvious case mapping, and making it compare equal to 'ss'/'SS' seems like too much of a hack...

Can ignore most of the rest of the Unicode space as (aside from Greek and Cyrillic and similar) most other alphabets do not have case.

Status:
Still in blackout, but parents have went and got a generator. Mostly using it to try to keep the refrigerator cold... Apparently the utility company estimates about a week to get power back online (Tulsa's grid kinda got wrecked by 100mph winds...).

> --
> Regards,
> John Levine, jo...@taugh.com, Primary Perpetrator of "The Internet for Dummies",
> Please consider the environment before reading this e-mail. https://jl.ly

Re: Faster Sort Algorithms

<1a6cbb36-74a1-4425-bafb-a2bae7c2bf5dn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32871&group=comp.arch#32871

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:6214:8e9:b0:62f:f054:1fa2 with SMTP id dr9-20020a05621408e900b0062ff0541fa2mr1426331qvb.5.1687211258350;
Mon, 19 Jun 2023 14:47:38 -0700 (PDT)
X-Received: by 2002:a05:6870:710:b0:1a0:85d3:3d74 with SMTP id
ea16-20020a056870071000b001a085d33d74mr1470524oab.0.1687211258045; Mon, 19
Jun 2023 14:47:38 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Mon, 19 Jun 2023 14:47:37 -0700 (PDT)
In-Reply-To: <4e653611-2eef-4eb2-924f-09c642228108n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:1700:291:29f0:74f8:d339:cf3e:69b;
posting-account=H_G_JQkAAADS6onOMb-dqvUozKse7mcM
NNTP-Posting-Host: 2600:1700:291:29f0:74f8:d339:cf3e:69b
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<u6aie4$guk$1@gal.iecc.com> <cA4iM.19344$F2qf.810@fx48.iad>
<560b9f97-fa0c-4cd9-b176-c9ab052cb3cfn@googlegroups.com> <u6q6j3$2qs0$1@gal.iecc.com>
<4e653611-2eef-4eb2-924f-09c642228108n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1a6cbb36-74a1-4425-bafb-a2bae7c2bf5dn@googlegroups.com>
Subject: Re: Faster Sort Algorithms
From: MitchAlsup@aol.com (MitchAlsup)
Injection-Date: Mon, 19 Jun 2023 21:47:38 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4347
 by: MitchAlsup - Mon, 19 Jun 2023 21:47 UTC

On Monday, June 19, 2023 at 2:55:35 PM UTC-5, BGB wrote:
> On Monday, June 19, 2023 at 1:25:43 PM UTC-5, John Levine wrote:
> > According to BGB <cr8...@gmail.com>:
> > >> >sort reasonably. Sorting UTF-8 gives the same order as if you decoded
> > >> >them to code points and sorted them.
> > >Though, stricmp/strnicmp is more of a problem:
> > >ASCII: Easy enough.
> > >1252: Also works, just needs more rules.
> > >UTF-8: Simple case: ASCII only. Non-simple case, "Oh No".
> > >
> > >Woud need different implementations to support both 1252 and UTF-8 and give sensible results...
> > What's not sensible about sorting UTF-8 into code point order?
> >
> The stricmp/strnicmp (AKA: strcasecmp/strncasecmp or _stricmp/_strnicmp) functions do a case-insensitive compare.
>
> This requires internally normalizing the case, which requires knowing the character encoding (if, say, the Latin1 characters are also intended to be case-insensitive).
>
{Beginning to text to be commented}
> I am not sure what the "standard" solution is though (the descriptions I had found make no reference to locale or character encoding).
>
> Or, one could make a case that these functions only apply to ASCII (and/or 1252) and have separate "_stricmp_u8" functions and similar?...
> > If you want a sort order that matches a language's dictionary order,
> > that's much harder, but it's not trivial in ASCII, either.
> Granted, but easy enough to define 'A' == 'a' for sake of case-insensitive compare, and ignore others.
>
> Then there are the accented characters, which are mostly a matter of mapping.
>
> The German "hard S" character has no obvious case mapping, and making it compare equal to 'ss'/'SS' seems like too much of a hack...
>
> Can ignore most of the rest of the Unicode space as (aside from Greek and Cyrillic and similar) most other alphabets do not have case.
{End of text being commented}
<
A perfect case illustrating "another layer of indirection" saves the day::
<
if( table[string1[i]] == table[string2[i]] ) continue;
<
The table solves the ASCII versus EBCIDIC versus field-data,
and solves the {German, Greek, Cyrillic,...} problems.
>
>
> Status:
> Still in blackout, but parents have went and got a generator. Mostly using it to try to keep the refrigerator cold... Apparently the utility company estimates about a week to get power back online (Tulsa's grid kinda got wrecked by 100mph winds...).
<
Makes me wonder about what electricity would cost if the transmission lines were able to withstand 100 MPH winds.....
<
> > --
> > Regards,
> > John Levine, jo...@taugh.com, Primary Perpetrator of "The Internet for Dummies",
> > Please consider the environment before reading this e-mail. https://jl.ly

Re: Faster Sort Algorithms

<39ae0054-3a67-4d4f-90b1-4623dd50cb15n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32872&group=comp.arch#32872

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:622a:1c5:b0:3f9:bd6a:b5d3 with SMTP id t5-20020a05622a01c500b003f9bd6ab5d3mr4477995qtw.5.1687215196086;
Mon, 19 Jun 2023 15:53:16 -0700 (PDT)
X-Received: by 2002:a05:6830:e82:b0:6b2:a874:693d with SMTP id
dp2-20020a0568300e8200b006b2a874693dmr1792760otb.3.1687215195814; Mon, 19 Jun
2023 15:53:15 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Mon, 19 Jun 2023 15:53:15 -0700 (PDT)
In-Reply-To: <1a6cbb36-74a1-4425-bafb-a2bae7c2bf5dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:387:f:641c:0:0:0:7;
posting-account=_zXfWQoAAAB4RAD8sxfcL-jV_TJhiDJH
NNTP-Posting-Host: 2600:387:f:641c:0:0:0:7
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<u6aie4$guk$1@gal.iecc.com> <cA4iM.19344$F2qf.810@fx48.iad>
<560b9f97-fa0c-4cd9-b176-c9ab052cb3cfn@googlegroups.com> <u6q6j3$2qs0$1@gal.iecc.com>
<4e653611-2eef-4eb2-924f-09c642228108n@googlegroups.com> <1a6cbb36-74a1-4425-bafb-a2bae7c2bf5dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <39ae0054-3a67-4d4f-90b1-4623dd50cb15n@googlegroups.com>
Subject: Re: Faster Sort Algorithms
From: cr88192@gmail.com (BGB)
Injection-Date: Mon, 19 Jun 2023 22:53:16 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 6330
 by: BGB - Mon, 19 Jun 2023 22:53 UTC

On Monday, June 19, 2023 at 4:47:39 PM UTC-5, MitchAlsup wrote:
> On Monday, June 19, 2023 at 2:55:35 PM UTC-5, BGB wrote:
> > On Monday, June 19, 2023 at 1:25:43 PM UTC-5, John Levine wrote:
> > > According to BGB <cr8...@gmail.com>:
> > > >> >sort reasonably. Sorting UTF-8 gives the same order as if you decoded
> > > >> >them to code points and sorted them.
> > > >Though, stricmp/strnicmp is more of a problem:
> > > >ASCII: Easy enough.
> > > >1252: Also works, just needs more rules.
> > > >UTF-8: Simple case: ASCII only. Non-simple case, "Oh No".
> > > >
> > > >Woud need different implementations to support both 1252 and UTF-8 and give sensible results...
> > > What's not sensible about sorting UTF-8 into code point order?
> > >
> > The stricmp/strnicmp (AKA: strcasecmp/strncasecmp or _stricmp/_strnicmp) functions do a case-insensitive compare.
> >
> > This requires internally normalizing the case, which requires knowing the character encoding (if, say, the Latin1 characters are also intended to be case-insensitive).
> >
> {Beginning to text to be commented}
> > I am not sure what the "standard" solution is though (the descriptions I had found make no reference to locale or character encoding).
> >
> > Or, one could make a case that these functions only apply to ASCII (and/or 1252) and have separate "_stricmp_u8" functions and similar?...
> > > If you want a sort order that matches a language's dictionary order,
> > > that's much harder, but it's not trivial in ASCII, either.
> > Granted, but easy enough to define 'A' == 'a' for sake of case-insensitive compare, and ignore others.
> >
> > Then there are the accented characters, which are mostly a matter of mapping.
> >
> > The German "hard S" character has no obvious case mapping, and making it compare equal to 'ss'/'SS' seems like too much of a hack...
> >
> > Can ignore most of the rest of the Unicode space as (aside from Greek and Cyrillic and similar) most other alphabets do not have case.
> {End of text being commented}
> <
> A perfect case illustrating "another layer of indirection" saves the day::
> <
> if( table[string1[i]] == table[string2[i]] ) continue;
> <
> The table solves the ASCII versus EBCIDIC versus field-data,
> and solves the {German, Greek, Cyrillic,...} problems.

Yeah, NTFS sorta used this approach IIRC, and embedded the tables into the filesystem.

Looking around more, I found out:
Conventionally, it is based on locale settings (which in my case, likely means "Assume 1252 by default unless locale is set to 'C.UTF-8' or similar").

Apparently, the more standard behavior is to normalize to lower case before the compare, but the C library I am using normalizes to upper case. If I remember, may need to fix this once power is back...

Before power went out, had worked some on speeding up these functions, as it turns out they were eating a lot of CPU time in some programs (had reworked them some to work on blocks of 8 chars at a time, but this would only work for
ASCII/1252).

Some of this is related to trying to hunt down remaining cases where programs behave differently when built on BJX2 than on native x86 targets...

> >
> >
> > Status:
> > Still in blackout, but parents have went and got a generator. Mostly using it to try to keep the refrigerator cold... Apparently the utility company estimates about a week to get power back online (Tulsa's grid kinda got wrecked by 100mph winds...).
> <
> Makes me wonder about what electricity would cost if the transmission lines were able to withstand 100 MPH winds.....

Dunno. Could bury the lines, but this probably wouldn't work well for high voltage transmission lines. Buried lines aren't really a thing here, mostly just wooden utility poles.

Like, say, if 100kV lines required, say, 8-10" of fiberglass and silicone insulation or similar, this would likely be impractical.

Would likely be easier for 960V and 30kV lines though (eg, "most of them"), leaving mostly 100kV to 500kV on the big pylons... IIRC, for 30kV it is something like 2 inch silicone or similar.

Wind knocked over a bunch of trees and also a bunch of the utility poles, .... Most of the Tulsa metropolitan area was knocked out.

I guess during the storm in some places, there was a lot of flying trees and other debris that had took flight, ... Lots of flashes where the grid was getting torn up, and a whole lot of lightning as well.

Storm was relatively short, but was enough to make the whole house rumble at one point as it passed over. I guess in some places, buildings got damaged and windows blown-in, ...

Re: Faster Sort Algorithms

<u6qmqd$2r7g$1@gal.iecc.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32873&group=comp.arch#32873

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.cmpublishers.com!adore2!news.iecc.com!.POSTED.news.iecc.com!not-for-mail
From: johnl@taugh.com (John Levine)
Newsgroups: comp.arch
Subject: Re: Faster Sort Algorithms
Date: Mon, 19 Jun 2023 23:02:37 -0000 (UTC)
Organization: Taughannock Networks
Message-ID: <u6qmqd$2r7g$1@gal.iecc.com>
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com> <u6q6j3$2qs0$1@gal.iecc.com> <4e653611-2eef-4eb2-924f-09c642228108n@googlegroups.com> <1a6cbb36-74a1-4425-bafb-a2bae7c2bf5dn@googlegroups.com>
Injection-Date: Mon, 19 Jun 2023 23:02:37 -0000 (UTC)
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970";
logging-data="93424"; mail-complaints-to="abuse@iecc.com"
In-Reply-To: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com> <u6q6j3$2qs0$1@gal.iecc.com> <4e653611-2eef-4eb2-924f-09c642228108n@googlegroups.com> <1a6cbb36-74a1-4425-bafb-a2bae7c2bf5dn@googlegroups.com>
Cleverness: some
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: johnl@iecc.com (John Levine)
 by: John Levine - Mon, 19 Jun 2023 23:02 UTC

According to MitchAlsup <MitchAlsup@aol.com>:
>> > If you want a sort order that matches a language's dictionary order,
>> > that's much harder, but it's not trivial in ASCII, either.
>> Granted, but easy enough to define 'A' == 'a' for sake of case-insensitive compare, and ignore others.

If you just want English case folding it's easy. If you want dictionary order, or any other
language, it's much harder.

>> The German "hard S" character has no obvious case mapping, and making it compare equal to 'ss'/'SS' seems like too much of a hack...

This sort of stuff is very lanuage specific. In German, ö is usually
equivalent to oe, but in Scandanavian languages it is not. Even worse,
in Unicode there are two ways to represent ö, a single composed
character or a combining diaresis followed by a plain "o". People spend
years trying to get this right.

>> Can ignore most of the rest of the Unicode space as (aside from Greek and Cyrillic and similar) most other alphabets do not have case.

Yeah, but they have variants. Are the traditional and simplified
versions of Chinese characters equivalent or not? The answer is "it depends".

>A perfect case illustrating "another layer of indirection" saves the day::
><
> if( table[string1[i]] == table[string2[i]] ) continue;

That is so very, very, not adequate.

>Makes me wonder about what electricity would cost if the transmission lines were able to withstand 100 MPH winds.....

Well, you could visit New York City where they're all underground so it's not a problem.

--
Regards,
John Levine, johnl@taugh.com, Primary Perpetrator of "The Internet for Dummies",
Please consider the environment before reading this e-mail. https://jl.ly

Re: Faster Sort Algorithms

<670f83b5-1cee-46f2-84cd-67a91f780b3fn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32874&group=comp.arch#32874

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:620a:2450:b0:75f:216:4b8b with SMTP id h16-20020a05620a245000b0075f02164b8bmr4075856qkn.3.1687224493195;
Mon, 19 Jun 2023 18:28:13 -0700 (PDT)
X-Received: by 2002:a05:6871:6b81:b0:1a6:d0cc:58c0 with SMTP id
zh1-20020a0568716b8100b001a6d0cc58c0mr2057071oab.3.1687224492872; Mon, 19 Jun
2023 18:28:12 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Mon, 19 Jun 2023 18:28:12 -0700 (PDT)
In-Reply-To: <u6qmqd$2r7g$1@gal.iecc.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:387:f:641c:0:0:0:7;
posting-account=_zXfWQoAAAB4RAD8sxfcL-jV_TJhiDJH
NNTP-Posting-Host: 2600:387:f:641c:0:0:0:7
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<u6q6j3$2qs0$1@gal.iecc.com> <4e653611-2eef-4eb2-924f-09c642228108n@googlegroups.com>
<1a6cbb36-74a1-4425-bafb-a2bae7c2bf5dn@googlegroups.com> <u6qmqd$2r7g$1@gal.iecc.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <670f83b5-1cee-46f2-84cd-67a91f780b3fn@googlegroups.com>
Subject: Re: Faster Sort Algorithms
From: cr88192@gmail.com (BGB)
Injection-Date: Tue, 20 Jun 2023 01:28:13 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: BGB - Tue, 20 Jun 2023 01:28 UTC

On Monday, June 19, 2023 at 6:02:41 PM UTC-5, John Levine wrote:
> According to MitchAlsup <Mitch...@aol.com>:
> >> > If you want a sort order that matches a language's dictionary order,
> >> > that's much harder, but it's not trivial in ASCII, either.
> >> Granted, but easy enough to define 'A' == 'a' for sake of case-insensitive compare, and ignore others.
> If you just want English case folding it's easy. If you want dictionary order, or any other
> language, it's much harder.
> >> The German "hard S" character has no obvious case mapping, and making it compare equal to 'ss'/'SS' seems like too much of a hack...
> This sort of stuff is very lanuage specific. In German, ö is usually
> equivalent to oe, but in Scandanavian languages it is not. Even worse,
> in Unicode there are two ways to represent ö, a single composed
> character or a combining diaresis followed by a plain "o". People spend
> years trying to get this right.

I am probably going to take the simpler route and assume that 'O'=='o' (assume accent/umlaut, not sure how to type these on Android with a bluetooth keyboard). But, matching them with oe, probably not.

In this case, "hard S" would not have any case translation.

Probably, toupper/tolower will assume the existing "ambiguous 1252/unicode hybrid" space.

Will ignore collating rules, since those are strcoll's business; and seemingly the rules for "minimal valid implementation" allow treating strcoll as an alias to strcmp...

> >> Can ignore most of the rest of the Unicode space as (aside from Greek and Cyrillic and similar) most other alphabets do not have case.
> Yeah, but they have variants. Are the traditional and simplified
> versions of Chinese characters equivalent or not? The answer is "it depends".

I am probably going to conveniently ignore all this.

Probably Latin, Greek, Cyrillic, then call it done.
Probably also the existing practice of assuming 1252 and UTF-8, ignoring the existence of all the other codepages.

> >A perfect case illustrating "another layer of indirection" saves the day::
> ><
> > if( table[string1[i]] == table[string2[i]] ) continue;
> That is so very, very, not adequate.
> >Makes me wonder about what electricity would cost if the transmission lines were able to withstand 100 MPH winds.....
> Well, you could visit New York City where they're all underground so it's not a problem.

They could do this, and probably then avoid needing to repair the grid every "Tornado season", maybe also have fewer power bumps and short blackouts (common annoyance, power going out for 1-2 hours every 1 or 2 months or so, and short bumps maybe a few times per week, ...).

But, if you reduce maintenance work, then one risks people complaining about the loss of jobs, ...

OTOH, it would add cost.

It is sort of like how people go and say that things like public mass transit are a socialist pipe dream...

Like, theoretically, there are busses, but if the busses only have a limited number of stops and have a 2 hour wait time on most routes, not very useful...

Like, a common argument being that the only "safe" and "viable" form of transportation is to get an overly large pickup truck, ... Roads mostly full of large pickups and SUVs (and the occasional person driving a sedan style car).

Re: Faster Sort Algorithms

<u6rdrb$2c7fh$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32875&group=comp.arch#32875

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: terje.mathisen@tmsw.no (Terje Mathisen)
Newsgroups: comp.arch
Subject: Re: Faster Sort Algorithms
Date: Tue, 20 Jun 2023 07:35:38 +0200
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <u6rdrb$2c7fh$1@dont-email.me>
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<u6aie4$guk$1@gal.iecc.com> <cA4iM.19344$F2qf.810@fx48.iad>
<560b9f97-fa0c-4cd9-b176-c9ab052cb3cfn@googlegroups.com>
<u6q6j3$2qs0$1@gal.iecc.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 20 Jun 2023 05:35:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0557e3ff759bb7af8c67fdb82d0f00f2";
logging-data="2498033"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/GpMxsYVBTDW+Jx+O5iM1u5DdEnYvof/M/D4W9Ry0Qfg=="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.16
Cancel-Lock: sha1:nAOPq5EhnFdepc6dnx+QPxj+kmg=
In-Reply-To: <u6q6j3$2qs0$1@gal.iecc.com>
 by: Terje Mathisen - Tue, 20 Jun 2023 05:35 UTC

John Levine wrote:
> According to BGB <cr88192@gmail.com>:
>>>> sort reasonably. Sorting UTF-8 gives the same order as if you decoded
>>>> them to code points and sorted them.
>
>> Though, stricmp/strnicmp is more of a problem:
>> ASCII: Easy enough.
>> 1252: Also works, just needs more rules.
>> UTF-8: Simple case: ASCII only. Non-simple case, "Oh No".
>>
>> Woud need different implementations to support both 1252 and UTF-8 and give sensible results...
>
> What's not sensible about sorting UTF-8 into code point order?
>
> If you want a sort order that matches a language's dictionary order,
> that's much harder, but it's not trivial in ASCII, either.

Much, much harder: A is first, Å (Aring) is last in Norway and Denmark.

AA sorts the same as Å. I.e. you need to look for letter combinations
and sort them as a totally different code point.

Many years ago I hamdled this by creating sort keys which were
pre-digested into collating order, i.e. so that they could be sorted
with a pure binary byte array compare (like strcmp()).

Terje

--
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

Re: Faster Sort Algorithms

<u6rf3m$2cbcv$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32876&group=comp.arch#32876

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!rocksolid2!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: terje.mathisen@tmsw.no (Terje Mathisen)
Newsgroups: comp.arch
Subject: Re: Faster Sort Algorithms
Date: Tue, 20 Jun 2023 07:57:09 +0200
Organization: A noiseless patient Spider
Lines: 69
Message-ID: <u6rf3m$2cbcv$1@dont-email.me>
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<u6aie4$guk$1@gal.iecc.com> <cA4iM.19344$F2qf.810@fx48.iad>
<560b9f97-fa0c-4cd9-b176-c9ab052cb3cfn@googlegroups.com>
<u6q6j3$2qs0$1@gal.iecc.com>
<4e653611-2eef-4eb2-924f-09c642228108n@googlegroups.com>
<1a6cbb36-74a1-4425-bafb-a2bae7c2bf5dn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 20 Jun 2023 05:57:10 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a6c6963f4f8261b31c49707e36da2160";
logging-data="2502047"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19K+dzq12pvJGxfNEIqxrdx+8cjvFzpxVmndaK/tXiUvQ=="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.16
Cancel-Lock: sha1:VaSI2WlbNI0cwVvi8UvRPKqheQM=
In-Reply-To: <1a6cbb36-74a1-4425-bafb-a2bae7c2bf5dn@googlegroups.com>
 by: Terje Mathisen - Tue, 20 Jun 2023 05:57 UTC

MitchAlsup wrote:
> On Monday, June 19, 2023 at 2:55:35 PM UTC-5, BGB wrote:
>> On Monday, June 19, 2023 at 1:25:43 PM UTC-5, John Levine wrote:
>>> According to BGB <cr8...@gmail.com>:
>>>>>> sort reasonably. Sorting UTF-8 gives the same order as if you decoded
>>>>>> them to code points and sorted them.
>>>> Though, stricmp/strnicmp is more of a problem:
>>>> ASCII: Easy enough.
>>>> 1252: Also works, just needs more rules.
>>>> UTF-8: Simple case: ASCII only. Non-simple case, "Oh No".
>>>>
>>>> Woud need different implementations to support both 1252 and UTF-8 and give sensible results...
>>> What's not sensible about sorting UTF-8 into code point order?
>>>
>> The stricmp/strnicmp (AKA: strcasecmp/strncasecmp or _stricmp/_strnicmp) functions do a case-insensitive compare.
>>
>> This requires internally normalizing the case, which requires knowing the character encoding (if, say, the Latin1 characters are also intended to be case-insensitive).
>>
> {Beginning to text to be commented}
>> I am not sure what the "standard" solution is though (the descriptions I had found make no reference to locale or character encoding).
>>
>> Or, one could make a case that these functions only apply to ASCII (and/or 1252) and have separate "_stricmp_u8" functions and similar?...
>>> If you want a sort order that matches a language's dictionary order,
>>> that's much harder, but it's not trivial in ASCII, either.
>> Granted, but easy enough to define 'A' == 'a' for sake of case-insensitive compare, and ignore others.
>>
>> Then there are the accented characters, which are mostly a matter of mapping.
>>
>> The German "hard S" character has no obvious case mapping, and making it compare equal to 'ss'/'SS' seems like too much of a hack...
>>
>> Can ignore most of the rest of the Unicode space as (aside from Greek and Cyrillic and similar) most other alphabets do not have case.
> {End of text being commented}
> <
> A perfect case illustrating "another layer of indirection" saves the day::
> <
> if( table[string1[i]] == table[string2[i]] ) continue;
> <
> The table solves the ASCII versus EBCIDIC versus field-data,
> and solves the {German, Greek, Cyrillic,...} problems.

For speed you really want to do that lookup just once per key, instead
of twice per comparison. The only possible excpetion would be when the
keys are so long that storing a second copy runs out of memoery (or $L2
cache working set).

>>
>>
>> Status:
>> Still in blackout, but parents have went and got a generator. Mostly using it to try to keep the refrigerator cold... Apparently the utility company estimates about a week to get power back online (Tulsa's grid kinda got wrecked by 100mph winds...).
> <
> Makes me wonder about what electricity would cost if the transmission lines were able to withstand 100 MPH winds.....

Digging 400KV cables into the ground is about 3X more costly than
overhead power lines, but that does of course not translate into a 3X
cost for electricity, just for that specific part of the long distance
transmission. You could maybe add 3-10 cent/kWh?

Terje

> <
>>> --
>>> Regards,
>>> John Levine, jo...@taugh.com, Primary Perpetrator of "The Internet for Dummies",
>>> Please consider the environment before reading this e-mail. https://jl.ly

--
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

Re: Faster Sort Algorithms

<99c149f8-3909-45c9-91e3-c3e67ad198e0n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32877&group=comp.arch#32877

  copy link   Newsgroups: comp.arch
X-Received: by 2002:a05:620a:14e:b0:762:cead:1d3d with SMTP id e14-20020a05620a014e00b00762cead1d3dmr1383921qkn.3.1687278963260;
Tue, 20 Jun 2023 09:36:03 -0700 (PDT)
X-Received: by 2002:aca:bd85:0:b0:39e:8fcb:2ae2 with SMTP id
n127-20020acabd85000000b0039e8fcb2ae2mr2778536oif.4.1687278962985; Tue, 20
Jun 2023 09:36:02 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch
Date: Tue, 20 Jun 2023 09:36:02 -0700 (PDT)
In-Reply-To: <u6rf3m$2cbcv$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:387:c:6a13:0:0:0:2;
posting-account=_zXfWQoAAAB4RAD8sxfcL-jV_TJhiDJH
NNTP-Posting-Host: 2600:387:c:6a13:0:0:0:2
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<u6aie4$guk$1@gal.iecc.com> <cA4iM.19344$F2qf.810@fx48.iad>
<560b9f97-fa0c-4cd9-b176-c9ab052cb3cfn@googlegroups.com> <u6q6j3$2qs0$1@gal.iecc.com>
<4e653611-2eef-4eb2-924f-09c642228108n@googlegroups.com> <1a6cbb36-74a1-4425-bafb-a2bae7c2bf5dn@googlegroups.com>
<u6rf3m$2cbcv$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <99c149f8-3909-45c9-91e3-c3e67ad198e0n@googlegroups.com>
Subject: Re: Faster Sort Algorithms
From: cr88192@gmail.com (BGB)
Injection-Date: Tue, 20 Jun 2023 16:36:03 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: BGB - Tue, 20 Jun 2023 16:36 UTC

On Tuesday, June 20, 2023 at 12:57:14 AM UTC-5, Terje Mathisen wrote:
> MitchAlsup wrote:
> > On Monday, June 19, 2023 at 2:55:35 PM UTC-5, BGB wrote:
> >> On Monday, June 19, 2023 at 1:25:43 PM UTC-5, John Levine wrote:
> >>> According to BGB <cr8...@gmail.com>:
> >>>>>> sort reasonably. Sorting UTF-8 gives the same order as if you decoded
> >>>>>> them to code points and sorted them.
> >>>> Though, stricmp/strnicmp is more of a problem:
> >>>> ASCII: Easy enough.
> >>>> 1252: Also works, just needs more rules.
> >>>> UTF-8: Simple case: ASCII only. Non-simple case, "Oh No".
> >>>>
> >>>> Woud need different implementations to support both 1252 and UTF-8 and give sensible results...
> >>> What's not sensible about sorting UTF-8 into code point order?
> >>>
> >> The stricmp/strnicmp (AKA: strcasecmp/strncasecmp or _stricmp/_strnicmp) functions do a case-insensitive compare.
> >>
> >> This requires internally normalizing the case, which requires knowing the character encoding (if, say, the Latin1 characters are also intended to be case-insensitive).
> >>
> > {Beginning to text to be commented}
> >> I am not sure what the "standard" solution is though (the descriptions I had found make no reference to locale or character encoding).
> >>
> >> Or, one could make a case that these functions only apply to ASCII (and/or 1252) and have separate "_stricmp_u8" functions and similar?...
> >>> If you want a sort order that matches a language's dictionary order,
> >>> that's much harder, but it's not trivial in ASCII, either.
> >> Granted, but easy enough to define 'A' == 'a' for sake of case-insensitive compare, and ignore others.
> >>
> >> Then there are the accented characters, which are mostly a matter of mapping.
> >>
> >> The German "hard S" character has no obvious case mapping, and making it compare equal to 'ss'/'SS' seems like too much of a hack...
> >>
> >> Can ignore most of the rest of the Unicode space as (aside from Greek and Cyrillic and similar) most other alphabets do not have case.
> > {End of text being commented}
> > <
> > A perfect case illustrating "another layer of indirection" saves the day::
> > <
> > if( table[string1[i]] == table[string2[i]] ) continue;
> > <
> > The table solves the ASCII versus EBCIDIC versus field-data,
> > and solves the {German, Greek, Cyrillic,...} problems.
> For speed you really want to do that lookup just once per key, instead
> of twice per comparison. The only possible excpetion would be when the
> keys are so long that storing a second copy runs out of memoery (or $L2
> cache working set).

Lookup table versus rules is a tradeoff. Early on, rules-based logic was the winner here, but in a more recent test, lookup tables were faster, at least for ASCII/1252 range. For the rest of the BMP space, a lookup table would be too large. Also, for UTF-8, the logic for decoding codepoints would probably be a bigger issue than the logic for case-conversion.

Did read somewhere that for case insensitive compare with Unicode, the rule is more "case normalization" rather than simply converting to lower or upper case, though for the Latin alphabet and similar, the rule is lower case. IIRC, the idea was that Cyrillic (IIRC, not sure) and a few other alphabets normalized to upper case instead for the case-insensitive compare.

> >>
> >>
> >> Status:
> >> Still in blackout, but parents have went and got a generator. Mostly using it to try to keep the refrigerator cold... Apparently the utility company estimates about a week to get power back online (Tulsa's grid kinda got wrecked by 100mph winds...).
> > <
> > Makes me wonder about what electricity would cost if the transmission lines were able to withstand 100 MPH winds.....
> Digging 400KV cables into the ground is about 3X more costly than
> overhead power lines, but that does of course not translate into a 3X
> cost for electricity, just for that specific part of the long distance
> transmission. You could maybe add 3-10 cent/kWh?
>

Yeah, not sure what you would do for 400kV.

One possible guess for insulating the wire would be, say: Central conductor wrapped with fiberglass and silicone; thick layer of silica sand with some fiberglass and silicone (to add stability and keep water out), outer layer likely more fiberglass and silicone (to add durability). Solid rubber insulation would likely be cost prohibitive I think.

Insulating the wire would likely cost more than the conductor in this case. Would almost make sense to use thicker conductors operating at lower voltages to reduce the cost of the insulation (say, using a lot more 30kV or 50kV lines).

Otherwise, still blackout.
Did read that apparently they are sending over a bunch of utility trucks from Texas and similar to help out...

Re: Faster Sort Algorithms

<u6urv1$2sb4f$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32907&group=comp.arch#32907

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: terje.mathisen@tmsw.no (Terje Mathisen)
Newsgroups: comp.arch
Subject: Re: Faster Sort Algorithms
Date: Wed, 21 Jun 2023 14:54:56 +0200
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <u6urv1$2sb4f$1@dont-email.me>
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<u6aie4$guk$1@gal.iecc.com> <cA4iM.19344$F2qf.810@fx48.iad>
<560b9f97-fa0c-4cd9-b176-c9ab052cb3cfn@googlegroups.com>
<u6q6j3$2qs0$1@gal.iecc.com>
<4e653611-2eef-4eb2-924f-09c642228108n@googlegroups.com>
<1a6cbb36-74a1-4425-bafb-a2bae7c2bf5dn@googlegroups.com>
<u6rf3m$2cbcv$1@dont-email.me>
<99c149f8-3909-45c9-91e3-c3e67ad198e0n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 21 Jun 2023 12:54:57 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1d508b65ba38a91a132be5c835d48b25";
logging-data="3026063"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19CH9yxORZXuAvAIl2Y9/qcM/NoUuxVK4P6+qCz/yJKwQ=="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Firefox/91.0 SeaMonkey/2.53.16
Cancel-Lock: sha1:Th/vddwqujNIK13tPI1XKBq3stU=
In-Reply-To: <99c149f8-3909-45c9-91e3-c3e67ad198e0n@googlegroups.com>
 by: Terje Mathisen - Wed, 21 Jun 2023 12:54 UTC

BGB wrote:
> On Tuesday, June 20, 2023 at 12:57:14 AM UTC-5, Terje Mathisen
>>> transmission lines were able to withstand 100 MPH winds.....
>> Digging 400KV cables into the ground is about 3X more costly than
>> overhead power lines, but that does of course not translate into a
>> 3X cost for electricity, just for that specific part of the long
>> distance transmission. You could maybe add 3-10 cent/kWh?
>>
>
> Yeah, not sure what you would do for 400kV.
>
> One possible guess for insulating the wire would be, say: Central
> conductor wrapped with fiberglass and silicone; thick layer of silica
> sand with some fiberglass and silicone (to add stability and keep
> water out), outer layer likely more fiberglass and silicone (to add
> durability). Solid rubber insulation would likely be cost prohibitive
> I think.
>
> Insulating the wire would likely cost more than the conductor in this
> case. Would almost make sense to use thicker conductors operating at
> lower voltages to reduce the cost of the insulation (say, using a lot
> more 30kV or 50kV lines).

Below-ground cables, either directly deposited with a sand/gravel
wrapping, or inside a concrete culvert is well known technology. The
cables are interesting, with a lot of layers for electrical
conductivity, pulling strength and insulation.

Up in Rauland/Telemark the local power company is proactively digging
trenches and laying cables to replace overhead conductors in all the
places where history have shown ice buildup and/or heavy storm trefall
to be a problem.

Terje

--
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

Re: Faster Sort Algorithms

<u701dk$31orf$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32912&group=comp.arch#32912

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: cr88192@gmail.com (BGB)
Newsgroups: comp.arch
Subject: Re: Faster Sort Algorithms
Date: Wed, 21 Jun 2023 18:33:59 -0500
Organization: A noiseless patient Spider
Lines: 100
Message-ID: <u701dk$31orf$1@dont-email.me>
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com>
<u6aie4$guk$1@gal.iecc.com> <cA4iM.19344$F2qf.810@fx48.iad>
<560b9f97-fa0c-4cd9-b176-c9ab052cb3cfn@googlegroups.com>
<u6q6j3$2qs0$1@gal.iecc.com>
<4e653611-2eef-4eb2-924f-09c642228108n@googlegroups.com>
<1a6cbb36-74a1-4425-bafb-a2bae7c2bf5dn@googlegroups.com>
<u6rf3m$2cbcv$1@dont-email.me>
<99c149f8-3909-45c9-91e3-c3e67ad198e0n@googlegroups.com>
<u6urv1$2sb4f$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 21 Jun 2023 23:34:12 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="024e096215e51e110a7f4b97a422cf62";
logging-data="3203951"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Gl5p0Qlvy5gBcLjkMq3du"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.11.2
Cancel-Lock: sha1:i8a8wirsVaI+aL/7TI6ExlTEcOA=
Content-Language: en-US
In-Reply-To: <u6urv1$2sb4f$1@dont-email.me>
 by: BGB - Wed, 21 Jun 2023 23:33 UTC

On 6/21/2023 7:54 AM, Terje Mathisen wrote:
> BGB wrote:
>> On Tuesday, June 20, 2023 at 12:57:14 AM UTC-5, Terje Mathisen
>>>> transmission lines were able to withstand 100 MPH winds.....
>>> Digging 400KV cables into the ground is about 3X more costly than
>>> overhead power lines, but that does of course not translate into a
>>> 3X cost for electricity, just for that specific part of the long
>>> distance transmission. You could maybe add 3-10 cent/kWh?
>>>
>>
>> Yeah, not sure what you would do for 400kV.
>>
>> One possible guess for insulating the wire would be, say: Central
>> conductor wrapped with fiberglass and silicone; thick layer of silica
>> sand with some fiberglass and silicone (to add stability and keep
>> water out), outer layer likely more fiberglass and silicone (to add
>> durability). Solid rubber insulation would likely be cost prohibitive
>> I think.
>>
>> Insulating the wire would likely cost more than the conductor in this
>> case. Would almost make sense to use thicker conductors operating at
>> lower voltages to reduce the cost of the insulation (say, using a lot
>> more 30kV or 50kV lines).
>
> Below-ground cables, either directly deposited with a sand/gravel
> wrapping, or inside a concrete culvert is well known technology. The
> cables are interesting, with a lot of layers for electrical
> conductivity, pulling strength and insulation.
>
> Up in Rauland/Telemark the local power company is proactively digging
> trenches and laying cables to replace overhead conductors in all the
> places where history have shown ice buildup and/or heavy storm trefall
> to be a problem.
>

Makes sense.

Had looked, and it seems that insulating the cables for these voltages
doesn't require quite as much insulation as I had thought previously.

But, here, after a number of days (3 full days, Saturday and today being
partial days), power is now back on...

Though, there is a partial story for this:
Before this, I was off searching for my Arty-S7 board, but wasn't having
much luck finding it in my room, eventually I got partly frustrated, and
was sort of like "G-d, if you can point out where it is at, this would
be convenient." (Though, this was a sort of selfish request, which is
not necessarily a good thing; was half hoping for a sign to be like
"Yeah, it is over there"...).

A short time later, there was the weather alert for the approaching
storm. I posted a message about it on Twitter, then ended up putting PC
into hibernate mode. Maybe a few minutes later, the storm hit and
knocked out power.

It kinda sucked, but did on-off continue the search for the Arty-S7
board. Pretty much as soon as I found it, the power came back on...

Though, granted, the storm would have happened either way (not like
anything I am doing would matter enough to warrant something like this),
but like, weird stuff like this does happen sometimes (though usually on
a much smaller scale).

Like, I don't really see or hear anything directly. But, if I consider
doing something He wouldn't necessarily approve of, then everything
starts going to crap.

Almost sort of like in the "Book of Jonah" in this sense, just without
any obvious "mission" (or "message") in this case (nor any sort of
direct/tangible confirmation of His presence...).

Well, other examples were cases like, say, at one point I was going to
try to express interest in a female (who I possibly had a chance with),
but before I could give her a note doing so, a gas line exploded and
everyone had to be evacuated from the building. But, yeah, just a long
stream of seemingly random events sort of like this.

Did sort of barter that if He showed me where it was at, I would give
some sort of public acknowledgement of this. Though not exactly what I
had in mind, but I guess I am still under some obligation to give it
mention...

People can think what they will...
Not sure this would accomplish anything, in any case.

Not sure if there is anything else I should mention here.
Will not try to claim to be exactly a model example of piety though, in
any case...

I guess presumably now I can get back to "business as usual" (working on
my projects and similar; and then needing to divide my time with
machining parts out of metal, ...).

Re: off topic - burying electrical lines

<kloc9i16rpnfilqbo5gofsopud5eiug5d0@4ax.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=32926&group=comp.arch#32926

  copy link   Newsgroups: comp.arch
Path: i2pn2.org!rocksolid2!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: gneuner2@comcast.net (George Neuner)
Newsgroups: comp.arch
Subject: Re: off topic - burying electrical lines
Date: Sat, 24 Jun 2023 00:15:58 -0400
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <kloc9i16rpnfilqbo5gofsopud5eiug5d0@4ax.com>
References: <4abb287e-88eb-485a-916e-50a0a3b0d68cn@googlegroups.com> <u6aie4$guk$1@gal.iecc.com> <cA4iM.19344$F2qf.810@fx48.iad> <560b9f97-fa0c-4cd9-b176-c9ab052cb3cfn@googlegroups.com> <u6q6j3$2qs0$1@gal.iecc.com> <4e653611-2eef-4eb2-924f-09c642228108n@googlegroups.com> <1a6cbb36-74a1-4425-bafb-a2bae7c2bf5dn@googlegroups.com> <u6rf3m$2cbcv$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="279c6750e5a4ad6a655a41491f1bec77";
logging-data="35737"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18rO+XAtcogDXXK56RJSTouCevUgTehK2M="
User-Agent: ForteAgent/8.00.32.1272
Cancel-Lock: sha1:yDhwELIx/ZyXJpLIvWa789zKqVc=
 by: George Neuner - Sat, 24 Jun 2023 04:15 UTC

On Tue, 20 Jun 2023 07:57:09 +0200, Terje Mathisen
<terje.mathisen@tmsw.no> wrote:

>Digging 400KV cables into the ground is about 3X more costly than
>overhead power lines, but that does of course not translate into a 3X
>cost for electricity, just for that specific part of the long distance
>transmission. You could maybe add 3-10 cent/kWh?

That's just simple installation ... in the US at least you would have
to add in the costs of obtaining permission to dig: state, local, and
maybe federal also depending on where. Then there would be endless
lawsuits from environmentalists worried about ground squirrels (or
whatever) being displaced by digging, and from neighbors (if there are
any) concerned about how the digging would be disruptive to their
lives, or how the buried lines might be dangerous to them.

The higher the line voltage, the more opposition you would face. In
many places local 10..20 KV lines do get buried [they are in my
community], but people regularly see those same voltage wires on poles
so they aren't terribly afraid of them. However, start talking about
burying 100+KV lines that normally are strung on /towers/ protected by
fences ... then people start to freak out.

By the time you started digging, you would already have spent 10..15
times the simple installation cost just getting permission to do it.

And note that you would face exactly the same obstacles trying to put
up a line of transmission towers - however the line of towers would be
far less costly than digging a ditch of the same length. You can guess
what happens.

>Terje

YMMV,
George


devel / comp.arch / Re: Faster Sort Algorithms

Pages:1234
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor