Article View: comp.lang.c
Article #1959Re: C and its peasant 'ancestors'
From: Ross Finlayson
Date: Sat, 28 Nov 2026 22:29
Date: Sat, 28 Nov 2026 22:29
155 lines
7481 bytes
7481 bytes
On 11/28/2026 10:18 AM, Michael S wrote:
> On Sat, 28 Nov 2026 18:12:36 +0000
> bartc <bc@freeuk.com> wrote:
>
>> On 28/11/2026 16:31, Bonita Montero wrote:
>>> Am 28.11.2026 um 16:28 schrieb bartc:
>>>
>>>> Yet every example of C++ you've ever posted is always an
>>>> unreadable, ugly mess of syntax.
>>>
>>> A very disordered opinion.
>>>
>>>> Not all that is the fault of the language - you seem to delight in
>>>> using every obscure feature possible and have nested functions
>>>> everywhere.
>>>
>>> C++-developers understand my code since they're more skilled like
>>> you.
>>
>> It's not a skills issue. The language as used like this is several
>> times more complex than is needed.
>>
>>
>>>> Below is a recent post of yours about sorting in C++. It took me a
>>>> while to realise it was actually testing two kinds of sort!
>>>
>>> I don't know why this should be hard to understand.
>>> Maybe it's beyond your capabilities.
>>
>> Because it's a ******* mess. Here's a function you created simply for
>> copying one array to another:
>>
>> auto cpy = [&] { copy( origin.begin(), origin.end(), srt.begin()
>> ); dummy += srt[0]; };
>>
>> 37 tokens. Here is what I used:
>>
>> sdata := data
>>
>> 3 tokens, and no functions. Even C needs only 12 tokens:
>>
>> memcpy(sdata, data, sizeof(data));
>>
>> It's also ironic in that you go on about having to implement stuff in
>> C that is provided in C++, yet you have to write your own vector copy?
>>
>> Would 'src = origin' work, and if so why not just use it?
>>
>> You just want to use as many toys as possible for no reason.
>>
>
> Here I agree.
>
>>
>>>> As for timings, then for 10000 sorts of 4096 random integers in
>>>> the i32 range, they were:
>>>>
>>>> C++/g++-O3 qsrt 3.5 seconds
>>>> C++/g++-O3 stdsort 1.5 seconds
>>>> My lang 2.5 seconds
>>>> C/gcc-O2 2.5 seconds
>>>> C/bcc 2.5 seconds
>>>
>>> As I said you can be on par with std::sort(),
>>
>> Why is your qsrt 40% slower than the most basic version in C?
>>
>> > but it makes a lot of work> since you've to implement the
>> > quicksort
>> yourself; including all optimi-
>>> zations beyond the "homework-solution".
>>
>> I'm sure somebody has already written an optimised sort routine in C,
>> you just have to find it. Google-AI gave me a fast version of
>> quicksort, and that has timing of 1.8 seconds the for the above task.
>>
>> That's 20% slower than your stdsort. But if I tweak the task, so I
>> sort 64K numbers 1000 times, then optimised C is 14% faster then
>> optimised C++/stdsort.
>>
>>
>>
>>
>>>> However, this is what happens when optimisation is turned off in
>>>> all cases (in my tools, that just means locals stay in memory):
>>>>
>>>> C++/g++-O0 qsrt 7.0 seconds
>>>> C++/g++-O0 stdsort 16.8 seconds
>>>> My lang -no 3.7 seconds
>>>> C/gcc-O0 4.0 seconds
>>>> C/bcc -no 4.0 seconds
>>>> Now C++'s stdsort is more than twice as slow as your qsrt! And 4
>>>> times as slow as that 'isort' in C.
>>>> So unoptimised C++ is slower than a scripting language!
>>
>>> Where's the problem ?
>>
>> One problem is that compiling this 60-line C++ program took 2.6
>> seconds, but compiling the now-90-line C version took 0.025 seconds
>> (100 times faster).
>>
>> This is with my non-optimising compiler, but it was still slightly
>> faster than C++ sort for N=64K (4.7s vs 4.8s).
>
> Here I disagree.
> std::sort is not just fast. It is also more convinient.
>
>
>
>
One might consider SIMD "shake-sort" for regions then merge-sort
and up and down, since the smaller unit's an order of magnitude faster,
vis-a-vis, usual accounts of all one speed the linear.
The "shake-sort" is usually considered among the slowest approaches
in accounts of sort algorithms, like "Tim-sort" and so on, yet,
in the tribological has that it's how nature sorts many things.
SIMD is basically only "linear-speedup", say, yet, the
alias/stall/branch/call/fault-less is quite a large constant the on the
order
of 1000, for example when sorting things like less than on the order of 10.
When people say hash-map is constant-time, it's thoroughly aggravating,
yet I figure they're just repeating what they were told, instead of
looking at it and seeing it out, and getting more performance in the
telling, like fishermen with the biggest fish that got away.
It's like map-reduce and uniform keys, vis-a-vis the entirely usual
account of:
"modes, principals, majors, minors, lessers, and the long tail",
vis-a-vis "the normal distribution" or "it's linear" when "it's < 5".
I have a statistics minor so people talking about "Big Data and the
Power Law" get a low estimate of statistical confidence.
Accounts of "Numerical approximations of NP-hard problems in polynomial
time", has that that's a great book from the 1990's that gets into
whether "factorial-time" is less than "exponential-time", and for
example whether that's independent standard number theory: "Ramsey
theory", about Ramsey theory and non-standard Ramsey theory in asymptotics.
Technical Details
Message-ID:
<yTmdnXd94KpUyJb2nZ2dnZfqn_idnZ2d@giganews.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!weretis.net!feeder9.news.weretis.net!border-3.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mailReferences:
<11dup6q$v4j9$1@dont-email.me> <11e0kde$1jpvu$1@dont-email.me> <11e0r13$1lqm6$1@dont-email.me> <11e0uc0$1mtpv$1@raubtier-asyl.eternal-september.org> <11e7fj4$37l9$1@dont-email.me> <11e8oro$ft4l$1@raubtier-asyl.eternal-september.org> <11e8stp$hajr$1@dont-email.me> <11e8ti0$hhqa$1@dont-email.me> <11e8v24$i2mc$2@raubtier-asyl.eternal-september.org> <11e9045$ihk3$1@dont-email.me> <11e90a8$ikh0$1@dont-email.me> <11e90mv$io87$2@raubtier-asyl.eternal-september.org> <11e91ns$j5dv$1@dont-email.me> <11e92ff$jclo$1@raubtier-asyl.eternal-september.org> <11e95j2$kimu$1@dont-email.me> <11e96aa$kpta$1@raubtier-asyl.eternal-september.org> <11ect54$20qpr$3@dont-email.me> <11edmpn$2938p$1@raubtier-asyl.eternal-september.org> <11eerur$2me3k$1@dont-email.me> <11eevkk$2nu8b$1@raubtier-asyl.eternal-september.org> <11ef5ik$2q9c9$1@dont-email.me> <20261128201856.00000619@yahoo.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!weretis.net!feeder9.news.weretis.net!border-3.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 28 Nov 2026 22:29:29 +0000 Subject: Re: C and its peasant 'ancestors' Newsgroups: comp.lang.c References: <11dup6q$v4j9$1@dont-email.me> <11e0kde$1jpvu$1@dont-email.me> <11e0r13$1lqm6$1@dont-email.me> <11e0uc0$1mtpv$1@raubtier-asyl.eternal-september.org> <11e7fj4$37l9$1@dont-email.me> <11e8oro$ft4l$1@raubtier-asyl.eternal-september.org> <11e8stp$hajr$1@dont-email.me> <11e8ti0$hhqa$1@dont-email.me> <11e8v24$i2mc$2@raubtier-asyl.eternal-september.org> <11e9045$ihk3$1@dont-email.me> <11e90a8$ikh0$1@dont-email.me> <11e90mv$io87$2@raubtier-asyl.eternal-september.org> <11e91ns$j5dv$1@dont-email.me> <11e92ff$jclo$1@raubtier-asyl.eternal-september.org> <11e95j2$kimu$1@dont-email.me> <11e96aa$kpta$1@raubtier-asyl.eternal-september.org> <11ect54$20qpr$3@dont-email.me> <11edmpn$2938p$1@raubtier-asyl.eternal-september.org> <11eerur$2me3k$1@dont-email.me> <11eevkk$2nu8b$1@raubtier-asyl.eternal-september.org> <11ef5ik$2q9c9$1@dont-email.me> <20261128201856.00000619@yahoo.com> From: Ross Finlayson <ross.a.finlayson@gmail.com> Date: Sat, 28 Nov 2026 14:29:15 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20261128201856.00000619@yahoo.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <yTmdnXd94KpUyJb2nZ2dnZfqn_idnZ2d@giganews.com> Lines: 155 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-d9eJpuatXn5gDLy/ccLy0k95zNXZG4iGiPp0L0aQy6qcVG8A/lYs1KgndhngEOijQy34q86dCN/IMYJ!VlAaQKYX/k/XQsXYLFYyJTjyxsXYoWV3yrqM1M2SXLDVb3hpaFyzYn9W1A1xUU13J6RJ/3DYUjHi X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40