Article View: comp.lang.c
Article #1928Re: C and its peasant 'ancestors'
From: bartc
Date: Sat, 28 Nov 2026 18:12
Date: Sat, 28 Nov 2026 18:12
94 lines
5274 bytes
5274 bytes
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.
>> 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).
Technical Details
Message-ID:
<11ef5ik$2q9c9$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.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>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: bartc <bc@freeuk.com> Newsgroups: comp.lang.c Subject: Re: C and its peasant 'ancestors' Date: Sat, 28 Nov 2026 18:12:36 +0000 Organization: A noiseless patient Spider Lines: 94 Message-ID: <11ef5ik$2q9c9$1@dont-email.me> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sat, 28 Nov 2026 18:12:36 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2958729"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19tbfkWTAJU+Z8ySi7iajGz"; posting-host="0d82bebd73fa202dc7ad3cf5c365f7ca" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:jAZUvEg9xKnDXSi7vtHOhh0Jk44= sha256:yAMfDTY3wTDjtGS8PHE2Cr5q0SvzZpoZ+ewMaUT8AGg= sha1:mtpiUFoNVEX3DqU9xWk+sxRaYtg= sha256:xwH23VdXLqUgdlwYJltjk8lkiyv8cjDhwnf7z64sWng= Content-Language: en-GB In-Reply-To: <11eevkk$2nu8b$1@raubtier-asyl.eternal-september.org>