Article View: comp.lang.c
Article #1930Re: C and its peasant 'ancestors'
From: Michael S
Date: Sat, 28 Nov 2026 18:18
Date: Sat, 28 Nov 2026 18:18
110 lines
5888 bytes
5888 bytes
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.
Technical Details
Message-ID:
<20261128201856.00000619@yahoo.com>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> <11ef5ik$2q9c9$1@dont-email.me>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: Michael S <already5chosen@yahoo.com> Newsgroups: comp.lang.c Subject: Re: C and its peasant 'ancestors' Date: Sat, 28 Nov 2026 20:18:56 +0200 Organization: A noiseless patient Spider Lines: 110 Message-ID: <20261128201856.00000619@yahoo.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Injection-Date: Sat, 28 Nov 2026 18:18:57 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2941458"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19B5hVwQY4j0a6PjxmVfBzChR4IYbLlTJc="; posting-host="76daf7441b37bbc2a2e16c64897ce957" Cancel-Lock: sha1:Jm3BueMPQN/Ax/7uWFjhH8zMd/k= sha256:WpyAcAlEEBLHyHsOmHmU0X9Oe8vcxMLbk7J19F2cLs4= sha1:+mxe3jbphWHrQxSTUoUeKFGWgcU= sha256:CpP9cy+iBIdRvuC9/05MLLaeZ+rmBlSwrcbpMaNRtO0= X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)