Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Neil Armstrong tripped.


devel / comp.lang.c++ / Re: Ain't that beautiful ?

SubjectAuthor
* Ain't that beautiful ?Bonita Montero
`* Re: Ain't that beautiful ?Michael S
 +* Re: Ain't that beautiful ?Sam
 |`* Re: Ain't that beautiful ?Scott Lurndal
 | `* Re: Ain't that beautiful ?Michael S
 |  `* Re: Ain't that beautiful ?Bonita Montero
 |   `* Re: Ain't that beautiful ?Michael S
 |    `* Re: Ain't that beautiful ?Bonita Montero
 |     `* Re: Ain't that beautiful ?Chris M. Thomasson
 |      `* Re: Ain't that beautiful ?Bonita Montero
 |       `* Re: Ain't that beautiful ?Scott Lurndal
 |        `* Re: Ain't that beautiful ?Bonita Montero
 |         `- Re: Ain't that beautiful ?Chris M. Thomasson
 `* Re: Ain't that beautiful ?Bonita Montero
  `* Re: Ain't that beautiful ?Michael S
   `* Re: Ain't that beautiful ?Bonita Montero
    `* Re: Ain't that beautiful ?Scott Lurndal
     `* Re: Ain't that beautiful ?Bonita Montero
      `* Re: Ain't that beautiful ?Scott Lurndal
       +- Re: Ain't that beautiful ?Bonita Montero
       `* Re: Ain't that beautiful ?Paavo Helde
        +* Re: Ain't that beautiful ?Scott Lurndal
        |+* Re: Ain't that beautiful ?Bonita Montero
        ||`* Re: Ain't that beautiful ?wij
        || `* Re: Ain't that beautiful ?Bonita Montero
        ||  `- Re: Ain't that beautiful ?wij
        |`- Re: Ain't that beautiful ?Michael S
        `* Re: Ain't that beautiful ?Michael S
         +* Re: Ain't that beautiful ?David Brown
         |+* Re: Ain't that beautiful ?Michael S
         ||+- Re: Ain't that beautiful ?Scott Lurndal
         ||+- Re: Ain't that beautiful ?David Brown
         ||`- Re: Ain't that beautiful ?Bonita Montero
         |`* std::map advocacyMichael S
         | +* Re: std::map advocacyDavid Brown
         | |`* Re: std::map advocacyMichael S
         | | `* Re: std::map advocacyDavid Brown
         | |  +* Re: std::map advocacyMichael S
         | |  |+* Re: std::map advocacywij
         | |  ||`* Re: std::map advocacyMichael S
         | |  || `* Re: std::map advocacywij
         | |  ||  `* Re: std::map advocacyMichael S
         | |  ||   `- Re: std::map advocacyBonita Montero
         | |  |+- Re: std::map advocacyDavid Brown
         | |  |`* Re: std::map advocacyScott Lurndal
         | |  | `* Re: std::map advocacyMichael S
         | |  |  +* Re: std::map advocacyScott Lurndal
         | |  |  |`* Re: std::map advocacyMichael S
         | |  |  | `- Re: std::map advocacyScott Lurndal
         | |  |  `* Re: std::map advocacyDavid Brown
         | |  |   `* Re: std::map advocacyMichael S
         | |  |    `- Re: std::map advocacyDavid Brown
         | |  `* Re: std::map advocacyRichard Damon
         | |   `* Re: std::map advocacyDavid Brown
         | |    `* Re: std::map advocacyJames Kuyper
         | |     `* Re: std::map advocacyDavid Brown
         | |      `* Re: std::map advocacyMichael S
         | |       `* Re: std::map advocacyDavid Brown
         | |        `* Re: std::map advocacyMichael S
         | |         +- Re: std::map advocacyDavid Brown
         | |         `* Re: std::map advocacyJames Kuyper
         | |          `* Re: std::map advocacyMichael S
         | |           `* Re: std::map advocacyDavid Brown
         | |            `* Re: std::map advocacywij
         | |             +* Re: std::map advocacyDavid Brown
         | |             |+* Re: std::map advocacyBonita Montero
         | |             ||`* Re: std::map advocacyMichael S
         | |             || `* Re: std::map advocacyBonita Montero
         | |             ||  `* Re: std::map advocacyMichael S
         | |             ||   `- Re: std::map advocacyBonita Montero
         | |             |`* Re: std::map advocacywij
         | |             | `- Re: std::map advocacyDavid Brown
         | |             `* Re: std::map advocacyMichael S
         | |              `- Re: std::map advocacyPaavo Helde
         | +* Re: std::map advocacyScott Lurndal
         | |+* Re: std::map advocacyMichael S
         | ||`- Re: std::map advocacyBonita Montero
         | |`- Re: std::map advocacyPaavo Helde
         | `* Re: std::map advocacyBonita Montero
         |  `* Re: std::map advocacyMichael S
         |   `* Re: std::map advocacyBonita Montero
         |    `* Re: std::map advocacyMichael S
         |     `* Re: std::map advocacyBonita Montero
         |      `* Re: std::map advocacyMichael S
         |       +- Re: std::map advocacyMichael S
         |       `- Re: std::map advocacyBonita Montero
         +* Re: Ain't that beautiful ?Bonita Montero
         |`* Re: Ain't that beautiful ?Michael S
         | `- Re: Ain't that beautiful ?Bonita Montero
         `- Re: Ain't that beautiful ?Paavo Helde

Pages:1234
Re: Ain't that beautiful ?

<uuub65$2r67g$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3511&group=comp.lang.c%2B%2B#3511

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sun, 7 Apr 2024 16:39:02 +0200
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <uuub65$2r67g$1@raubtier-asyl.eternal-september.org>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 14:39:01 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="700d8c77c3a1204baa8bd911c63ba530";
logging-data="2988272"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX189nMBHPfz1ttuwL8bk6z4s/S28WvokQdY="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:b6F8JH9YQlvFgAJfCD3G6NXGeWc=
In-Reply-To: <20240407160050.00004370@yahoo.com>
Content-Language: de-DE
 by: Bonita Montero - Sun, 7 Apr 2024 14:39 UTC

Am 07.04.2024 um 15:00 schrieb Michael S:

> $ gcc -c -Wall -O2 foo.cpp raii-foo.cpp
> $ size *.o
> text data bss dec hex filename
> 136 0 0 136 88 foo.o
> 172 0 0 172 ac raii-foo.o
>

That's because of the unrolling code for exceptions. But this
unrolling code is separate and usually not executed. The code
path for the non-exceptional case should have the same perfor-
mance.

Re: Ain't that beautiful ?

<uuudsl$2rrgv$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3512&group=comp.lang.c%2B%2B#3512

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: eesn...@osa.pri.ee (Paavo Helde)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sun, 7 Apr 2024 18:25:09 +0300
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <uuudsl$2rrgv$1@dont-email.me>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 15:25:10 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="c0a9ab1877bd52e241b0d5add20725da";
logging-data="3010079"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX184XnnN6V08X1m4WL5vjc3dBpfaf9ISzXE="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:5+XGQg8WEEjHEYPFnUEXZ6HBqJ4=
Content-Language: en-US
In-Reply-To: <20240407160050.00004370@yahoo.com>
 by: Paavo Helde - Sun, 7 Apr 2024 15:25 UTC

07.04.2024 16:00 Michael S kirjutas:
> On Sat, 6 Apr 2024 17:29:45 +0300
> Paavo Helde <eesnimi@osa.pri.ee> wrote:
>>
>> run-time performance hits. But iostreams do not make up most of C++.
>>
>> Still, the best feature of C++ is RAII (zero run-time performance
>> hit).
>>
>
> RAII has low run-time cost, although I doubt that it's really zero.
> RAII has non-trivial code size cost, esp. when used a lot. See below.

The last time when I had to worry about code size was in year 1992, with
an Intel 80186 processor. But I understand it might be a concern in some
applications.

> But my main objection with RAII is that I feel like loosing track.

It's the opposite for me. I feel myself at ease and having control only
after I put a resource release properly under RAII.

Re: Ain't that beautiful ?

<20240407183728.00000ac4@yahoo.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3513&group=comp.lang.c%2B%2B#3513

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5...@yahoo.com (Michael S)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sun, 7 Apr 2024 18:37:28 +0300
Organization: A noiseless patient Spider
Lines: 59
Message-ID: <20240407183728.00000ac4@yahoo.com>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad>
<uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com>
<uuu98b$2qou0$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 15:37:33 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ea51c234139e61ddeb0e20c94eeecefb";
logging-data="2909767"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/b1PUX+KfenR9Ued97JSJrxk9XHdD3yM8="
Cancel-Lock: sha1:hUIkUZe/wk0dvHDXug/SNBj422Y=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
 by: Michael S - Sun, 7 Apr 2024 15:37 UTC

On Sun, 7 Apr 2024 16:06:02 +0200
David Brown <david.brown@hesbynett.no> wrote:

> On 07/04/2024 15:00, Michael S wrote:
> > On Sat, 6 Apr 2024 17:29:45 +0300
> > Paavo Helde <eesnimi@osa.pri.ee> wrote:
> >>
> >> run-time performance hits. But iostreams do not make up most of
> >> C++.
> >>
> >> Still, the best feature of C++ is RAII (zero run-time performance
> >> hit).
> >>
> >
> > RAII has low run-time cost, although I doubt that it's really zero.
> > RAII has non-trivial code size cost, esp. when used a lot. See
> > below. But my main objection with RAII is that I feel like loosing
> > track.
>
> > $ gcc -c -Wall -O2 foo.cpp raii-foo.cpp
> > $ size *.o
> > text data bss dec hex filename
> > 136 0 0 136 88 foo.o
> > 172 0 0 172 ac raii-foo.o
> >
>
> You will almost certainly find that the overhead here is due to
> exception handling and/or RTTI. Add the flag "-fno-execptions
> -fno-rtti", and you'll see the same code generated using
> <https://godbolt.org>.

Of course, it is due to exception!
But isn't exception safety the main point behind RAII?

RTTI plays no role here.
Is not RTTI supported only for classes with virtual functions?

>
> For some kinds of code (such as the stuff Scott does, and the stuff I
> do), exceptions are an unacceptable overhead, cost and complication
> in a language. Many other features of C++ - including RAII,
> templates, classes, namespaces, strong enums, overloading, concepts,
> constexpr, inline variables, smart pointers, and countless other bits
> and pieces can be used to get better source code (clearer, simpler,
> more flexible, safer, etc.) without inefficiency overheads compared
> to similar solutions in C.
>

I am not a fan of smart pointers.
The other thing you mentioned can help sometimes, but also can make
a mess of your codebase. And I had seen the later more often than the
former.
In particular, classes with big number of members are used by lazy
programmers to have what is in effect global variables without feeling
guilty.

std::map advocacy

<20240407183854.00000797@yahoo.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3514&group=comp.lang.c%2B%2B#3514

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5...@yahoo.com (Michael S)
Newsgroups: comp.lang.c++
Subject: std::map advocacy
Date: Sun, 7 Apr 2024 18:38:54 +0300
Organization: A noiseless patient Spider
Lines: 54
Message-ID: <20240407183854.00000797@yahoo.com>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad>
<uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com>
<uuu98b$2qou0$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 15:38:59 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ea51c234139e61ddeb0e20c94eeecefb";
logging-data="2909767"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/3T15Th2Qa262NFZ16LuIYofeLL0OoZBQ="
Cancel-Lock: sha1:tgsXGru5ztyyZNLqW2mI/5RQtxo=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
 by: Michael S - Sun, 7 Apr 2024 15:38 UTC

On Sun, 7 Apr 2024 16:06:02 +0200
David Brown <david.brown@hesbynett.no> wrote:

>
> Different people have different needs from C++, and use different
> features. If I were programming on a PC, I'd happily use std::map<>
> and the like. But I don't program on PC's, and I don't use
> std::map<>. If I needed something like that, I'd make my own class
> that fitted my requirements tightly - a factor of 10 inefficiency is
> often fine on big systems, but not on the devices I work with.
>
> But that's all fine - use whatever you find useful from the language.
>
>

Factor of 5-10 (mentioned in my other post) is quite rare and mostly
applies not to std::map vs custom implementation of RB or AVL tree, but
to std::map vs some form of hash, esp. when the nature of the key is
such that relatively simple hash function happens to have good
collision avoidance properties and when the database is huge, so O(1)
vs O(logN) starts to be significant.

Also pay attention that in situations where you do a lot of insertions
and deletions, and especially of deletions followed by insertions,
std::map::extract() could be of great help in reducing a cost of memory
allocation/delallocation to necessary minimum. It's relatively new
addition to std::map (C++17) and I'd guess that many C++ programmers
are not aware of its existence.

In my recent experience (I was implementing median filter over window
of few 1000s values), a use of extract() made clean and simple
std::map-based solution (well, actually std::multiset in this
particular case, but the same principles applies to
std::set/multiset/amp/multymap) faster than relatively more complicated
code based on boost:intrusive:map.

In this case I happened to have enough time to rewrite it in C with
my own implementation of AVL tree. My own code was only some 10 or
15% faster than std container's. And it took more than a day (may be
more than two days? I don't remember) to write and to debug. And that's
for me, who knows the algorithm (from TAoCP) for more than 40 years.
For somebody else it could easily take a weak.
In short, std::map and relatives is quite good piece of work.
Highly recommended. Consider me fan.

At the end in particular case of my unusually long median filter, it
turned out that AVL or RB tree is not the best structure for the job. A
couple of other structures (heap and tournament tree) work better. But
they don't work much better, only by factor of ~2.5. However both heap
and tournament tree are far less generically applicable data structures
than AVL/RB tree. They just happened to be better in this quite
special case.

Re: Ain't that beautiful ?

<20240407184156.00006d7b@yahoo.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3515&group=comp.lang.c%2B%2B#3515

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5...@yahoo.com (Michael S)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sun, 7 Apr 2024 18:41:56 +0300
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <20240407184156.00006d7b@yahoo.com>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad>
<uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com>
<uuub65$2r67g$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 15:42:01 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ea51c234139e61ddeb0e20c94eeecefb";
logging-data="2909767"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX181WMsYAb8RbTbpEfrVHWO9tG+1j19f/II="
Cancel-Lock: sha1:aKv4MWZeNkmh1Fm+n66RhpEgd9Y=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
 by: Michael S - Sun, 7 Apr 2024 15:41 UTC

On Sun, 7 Apr 2024 16:39:02 +0200
Bonita Montero <Bonita.Montero@gmail.com> wrote:

> Am 07.04.2024 um 15:00 schrieb Michael S:
>
> > $ gcc -c -Wall -O2 foo.cpp raii-foo.cpp
> > $ size *.o
> > text data bss dec hex filename
> > 136 0 0 136 88 foo.o
> > 172 0 0 172 ac raii-foo.o
> >
>
> That's because of the unrolling code for exceptions. But this
> unrolling code is separate and usually not executed. The code
> path for the non-exceptional case should have the same perfor-
> mance.
>

Didn't I say it myself about low runtime cost?

Re: Ain't that beautiful ?

<hizQN.166156$46Te.75316@fx38.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3516&group=comp.lang.c%2B%2B#3516

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!newsfeed.endofthelinebbs.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx38.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Ain't that beautiful ?
Newsgroups: comp.lang.c++
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org> <20240404215534.0000623d@yahoo.com> <cone.1712275227.292802.483430.1004@monster.email-scan.com> <CuHPN.189578$taff.30721@fx41.iad> <20240405174448.00001e50@yahoo.com> <uup59h$1esu3$2@raubtier-asyl.eternal-september.org> <20240405183723.0000585f@yahoo.com> <uup7dg$1febk$1@raubtier-asyl.eternal-september.org> <uusjso$2bl1s$1@dont-email.me> <uuteen$2kq8k$2@raubtier-asyl.eternal-september.org>
Lines: 17
Message-ID: <hizQN.166156$46Te.75316@fx38.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sun, 07 Apr 2024 15:51:41 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sun, 07 Apr 2024 15:51:41 GMT
X-Received-Bytes: 1563
 by: Scott Lurndal - Sun, 7 Apr 2024 15:51 UTC

Bonita Montero <Bonita.Montero@gmail.com> writes:
>Am 07.04.2024 um 00:55 schrieb Chris M. Thomasson:
>> On 4/5/2024 9:04 AM, Bonita Montero wrote:
>>> Am 05.04.2024 um 17:37 schrieb Michael S:
>>>
>>>> However I know enough to know that Win32 is defined in terms of C.
>>>> So I don't quite understand how XHANDLE can be part of it.
>>>
>>> It's obvious.
>>>
>>
>> Where is XHANDLE defined wrt any Microsoft documentation? Its not:
>
>It's obvious that XHANDE is some kind of RAII-wrapper.

https://www.logicallyfallacious.com/logicalfallacies/Appeal-to-Self-evident-Truth

Re: Ain't that beautiful ?

<fozQN.166157$46Te.114095@fx38.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3517&group=comp.lang.c%2B%2B#3517

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!198.186.191.154.MISMATCH!news-out.netnews.com!s1-1.netnews.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx38.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Ain't that beautiful ?
Newsgroups: comp.lang.c++
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org> <20240404215534.0000623d@yahoo.com> <uunpq1$14t9p$1@raubtier-asyl.eternal-september.org> <20240405175257.000066a0@yahoo.com> <uup56c$1esu3$1@raubtier-asyl.eternal-september.org> <GLYPN.6$zaCc.4@fx08.iad> <uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org> <03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me> <20240407160050.00004370@yahoo.com> <uuu98b$2qou0$1@dont-email.me> <20240407183728.00000ac4@yahoo.com>
Lines: 59
Message-ID: <fozQN.166157$46Te.114095@fx38.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sun, 07 Apr 2024 15:58:03 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sun, 07 Apr 2024 15:58:03 GMT
X-Received-Bytes: 3256
 by: Scott Lurndal - Sun, 7 Apr 2024 15:58 UTC

Michael S <already5chosen@yahoo.com> writes:
>On Sun, 7 Apr 2024 16:06:02 +0200
>David Brown <david.brown@hesbynett.no> wrote:
>
>> On 07/04/2024 15:00, Michael S wrote:
>> > On Sat, 6 Apr 2024 17:29:45 +0300
>> > Paavo Helde <eesnimi@osa.pri.ee> wrote:
>> >>

>> > RAII has low run-time cost, although I doubt that it's really zero.
>> > RAII has non-trivial code size cost, esp. when used a lot. See
>> > below. But my main objection with RAII is that I feel like loosing
>> > track.
>>
>> > $ gcc -c -Wall -O2 foo.cpp raii-foo.cpp
>> > $ size *.o
>> > text data bss dec hex filename
>> > 136 0 0 136 88 foo.o
>> > 172 0 0 172 ac raii-foo.o
>> >
>>
>> You will almost certainly find that the overhead here is due to
>> exception handling and/or RTTI. Add the flag "-fno-execptions
>> -fno-rtti", and you'll see the same code generated using
>> <https://godbolt.org>.
>
>Of course, it is due to exception!
>But isn't exception safety the main point behind RAII?

Not necessarily. We used RAII (perhaps before it was called
such) in 1989, in cfront 2.1 (exceptions didn't appear until 3.0)
as a way to bail (return) from a long function (a kernel implementation
of fork) and automatically deallocate various system resources
(assigned credentials, memory map/pt, new process attributes,
process-id, session/process group associations, etc) that
had been allocated before the fork failure was detected.

>
>RTTI plays no role here.
>Is not RTTI supported only for classes with virtual functions?

dynamic_cast requires RTTI.

>
>>
>> For some kinds of code (such as the stuff Scott does, and the stuff I
>> do), exceptions are an unacceptable overhead, cost and complication
>> in a language. Many other features of C++ - including RAII,
>> templates, classes, namespaces, strong enums, overloading, concepts,
>> constexpr, inline variables, smart pointers, and countless other bits
>> and pieces can be used to get better source code (clearer, simpler,
>> more flexible, safer, etc.) without inefficiency overheads compared
>> to similar solutions in C.
>>
>
>I am not a fan of smart pointers.

Concur.

Re: Ain't that beautiful ?

<uuufuu$2s7td$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3518&group=comp.lang.c%2B%2B#3518

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sun, 7 Apr 2024 18:00:30 +0200
Organization: A noiseless patient Spider
Lines: 94
Message-ID: <uuufuu$2s7td$1@dont-email.me>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com> <uuu98b$2qou0$1@dont-email.me>
<20240407183728.00000ac4@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 16:00:30 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ac5c995f1f99df99822eb6692eb89ffb";
logging-data="3022765"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1++LClZuN1AMAmzYmWv7Ec6cMpE+0vJZt8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:i0RZXUTFEmvuNxTsuUH6gVZICUs=
In-Reply-To: <20240407183728.00000ac4@yahoo.com>
Content-Language: en-GB
 by: David Brown - Sun, 7 Apr 2024 16:00 UTC

On 07/04/2024 17:37, Michael S wrote:
> On Sun, 7 Apr 2024 16:06:02 +0200
> David Brown <david.brown@hesbynett.no> wrote:
>
>> On 07/04/2024 15:00, Michael S wrote:
>>> On Sat, 6 Apr 2024 17:29:45 +0300
>>> Paavo Helde <eesnimi@osa.pri.ee> wrote:
>>>>
>>>> run-time performance hits. But iostreams do not make up most of
>>>> C++.
>>>>
>>>> Still, the best feature of C++ is RAII (zero run-time performance
>>>> hit).
>>>>
>>>
>>> RAII has low run-time cost, although I doubt that it's really zero.
>>> RAII has non-trivial code size cost, esp. when used a lot. See
>>> below. But my main objection with RAII is that I feel like loosing
>>> track.
>>
>>> $ gcc -c -Wall -O2 foo.cpp raii-foo.cpp
>>> $ size *.o
>>> text data bss dec hex filename
>>> 136 0 0 136 88 foo.o
>>> 172 0 0 172 ac raii-foo.o
>>>
>>
>> You will almost certainly find that the overhead here is due to
>> exception handling and/or RTTI. Add the flag "-fno-execptions
>> -fno-rtti", and you'll see the same code generated using
>> <https://godbolt.org>.
>
> Of course, it is due to exception!
> But isn't exception safety the main point behind RAII?
>

Not at all!

RAII is about encapsulating an acquire-release pair in a manner that
makes it easy to get right, and hard to get wrong, while minimising the
boiler-plate code needed at the time of use. It's convenience for use
with exceptions is almost completely incidental - as demonstrated by its
usefulness when exceptions are not used (many C++ users don't use
exceptions, and for a lot of use-cases, particularly embedded uses or
safety or reliability critical code, exceptions are totally banned), and
also by languages that have exceptions but not RAII.

RAII is neither sufficient nor necessary for exception safety, but it
certainly makes exception safety easier.

> RTTI plays no role here.

True - but RTTI goes along with exceptions as being a part of C++ that
adds overhead. If you don't use the information, it is generally just
wasted code space, rather than run time inefficiency, but for resource
limited systems, that's a relevant issue.

> Is not RTTI supported only for classes with virtual functions?

No, it gets used for dynamic casts, and for identifying the class of a
thrown exception. (At least, I think that's true - wait for others to
either correct me or confirm this before believing it!)

>
>>
>> For some kinds of code (such as the stuff Scott does, and the stuff I
>> do), exceptions are an unacceptable overhead, cost and complication
>> in a language. Many other features of C++ - including RAII,
>> templates, classes, namespaces, strong enums, overloading, concepts,
>> constexpr, inline variables, smart pointers, and countless other bits
>> and pieces can be used to get better source code (clearer, simpler,
>> more flexible, safer, etc.) without inefficiency overheads compared
>> to similar solutions in C.
>>
>
> I am not a fan of smart pointers.

Nobody likes /everything/ in C++ !

> The other thing you mentioned can help sometimes, but also can make
> a mess of your codebase. And I had seen the later more often than the
> former.

With great power, comes great responsibility - that's why we fear it :-)

Useful tools for writing better code can also be used to mess things up
in new and imaginative ways.

> In particular, classes with big number of members are used by lazy
> programmers to have what is in effect global variables without feeling
> guilty.
>

Re: std::map advocacy

<uuuga5$2s7td$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3519&group=comp.lang.c%2B%2B#3519

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c++
Subject: Re: std::map advocacy
Date: Sun, 7 Apr 2024 18:06:29 +0200
Organization: A noiseless patient Spider
Lines: 70
Message-ID: <uuuga5$2s7td$2@dont-email.me>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com> <uuu98b$2qou0$1@dont-email.me>
<20240407183854.00000797@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 16:06:29 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ac5c995f1f99df99822eb6692eb89ffb";
logging-data="3022765"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192gd/TTDVqj+eOzbA6cGpRDJTgqAO3F/E="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:EY2l7jt89NVqt1IoO8FfCDTwV9Q=
Content-Language: en-GB
In-Reply-To: <20240407183854.00000797@yahoo.com>
 by: David Brown - Sun, 7 Apr 2024 16:06 UTC

On 07/04/2024 17:38, Michael S wrote:
> On Sun, 7 Apr 2024 16:06:02 +0200
> David Brown <david.brown@hesbynett.no> wrote:
>
>>
>> Different people have different needs from C++, and use different
>> features. If I were programming on a PC, I'd happily use std::map<>
>> and the like. But I don't program on PC's, and I don't use
>> std::map<>. If I needed something like that, I'd make my own class
>> that fitted my requirements tightly - a factor of 10 inefficiency is
>> often fine on big systems, but not on the devices I work with.
>>
>> But that's all fine - use whatever you find useful from the language.
>>
>>
>
> Factor of 5-10 (mentioned in my other post) is quite rare and mostly
> applies not to std::map vs custom implementation of RB or AVL tree, but
> to std::map vs some form of hash, esp. when the nature of the key is
> such that relatively simple hash function happens to have good
> collision avoidance properties and when the database is huge, so O(1)
> vs O(logN) starts to be significant.
>

Sure.

But remember, for small embedded systems you don't have dynamic memory -
or if you do, you use it in limited and tightly controlled manner. And
in a real-time system, it is the worst-case time that matters, unlike
PC's where you are generally looking for average or amortized times. So
a data structure which allocates and deallocates memory unpredictably,
can use complex tree structures with little control of their worst-case
times - no thanks!

(And again, that does not mean these containers are not great choices
for all kinds of other uses.)

> Also pay attention that in situations where you do a lot of insertions
> and deletions, and especially of deletions followed by insertions,
> std::map::extract() could be of great help in reducing a cost of memory
> allocation/delallocation to necessary minimum. It's relatively new
> addition to std::map (C++17) and I'd guess that many C++ programmers
> are not aware of its existence.
>
> In my recent experience (I was implementing median filter over window
> of few 1000s values), a use of extract() made clean and simple
> std::map-based solution (well, actually std::multiset in this
> particular case, but the same principles applies to
> std::set/multiset/amp/multymap) faster than relatively more complicated
> code based on boost:intrusive:map.
>
> In this case I happened to have enough time to rewrite it in C with
> my own implementation of AVL tree. My own code was only some 10 or
> 15% faster than std container's. And it took more than a day (may be
> more than two days? I don't remember) to write and to debug. And that's
> for me, who knows the algorithm (from TAoCP) for more than 40 years.
> For somebody else it could easily take a weak.
> In short, std::map and relatives is quite good piece of work.
> Highly recommended. Consider me fan.
>
> At the end in particular case of my unusually long median filter, it
> turned out that AVL or RB tree is not the best structure for the job. A
> couple of other structures (heap and tournament tree) work better. But
> they don't work much better, only by factor of ~2.5. However both heap
> and tournament tree are far less generically applicable data structures
> than AVL/RB tree. They just happened to be better in this quite
> special case.
>
>

Re: std::map advocacy

<AyzQN.166158$46Te.62838@fx38.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3520&group=comp.lang.c%2B%2B#3520

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!nntp.comgw.net!peer01.ams4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx38.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: std::map advocacy
Newsgroups: comp.lang.c++
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org> <20240404215534.0000623d@yahoo.com> <uunpq1$14t9p$1@raubtier-asyl.eternal-september.org> <20240405175257.000066a0@yahoo.com> <uup56c$1esu3$1@raubtier-asyl.eternal-september.org> <GLYPN.6$zaCc.4@fx08.iad> <uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org> <03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me> <20240407160050.00004370@yahoo.com> <uuu98b$2qou0$1@dont-email.me> <20240407183854.00000797@yahoo.com>
Lines: 34
Message-ID: <AyzQN.166158$46Te.62838@fx38.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sun, 07 Apr 2024 16:09:04 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sun, 07 Apr 2024 16:09:04 GMT
X-Received-Bytes: 2718
 by: Scott Lurndal - Sun, 7 Apr 2024 16:09 UTC

Michael S <already5chosen@yahoo.com> writes:
>On Sun, 7 Apr 2024 16:06:02 +0200
>David Brown <david.brown@hesbynett.no> wrote:
>
>>
>> Different people have different needs from C++, and use different
>> features. If I were programming on a PC, I'd happily use std::map<>
>> and the like. But I don't program on PC's, and I don't use
>> std::map<>. If I needed something like that, I'd make my own class
>> that fitted my requirements tightly - a factor of 10 inefficiency is
>> often fine on big systems, but not on the devices I work with.
>>
>> But that's all fine - use whatever you find useful from the language.
>>
>>
>
>Factor of 5-10 (mentioned in my other post) is quite rare and mostly
>applies not to std::map vs custom implementation of RB or AVL tree, but
>to std::map vs some form of hash, esp. when the nature of the key is
>such that relatively simple hash function happens to have good
>collision avoidance properties and when the database is huge, so O(1)
>vs O(logN) starts to be significant.

The biggest problem I have with std::map is that you cannot
define a compile time map. For the application where we use
map, the maps can be quite large (hundreds or thousands of entries)
and initialization of those maps impacts application startup time
significantly (several hundred distinct maps).

We're planning on replacing std::map with a custom class optimized
to efficiently handle the data (mmap'd disk file generated by
a python script). A binary search on the primary key is the likely
search algorithm. The maps don't change during application execution.

Re: std::map advocacy

<20240407193505.00004d17@yahoo.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3521&group=comp.lang.c%2B%2B#3521

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5...@yahoo.com (Michael S)
Newsgroups: comp.lang.c++
Subject: Re: std::map advocacy
Date: Sun, 7 Apr 2024 19:35:05 +0300
Organization: A noiseless patient Spider
Lines: 65
Message-ID: <20240407193505.00004d17@yahoo.com>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad>
<uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com>
<uuu98b$2qou0$1@dont-email.me>
<20240407183854.00000797@yahoo.com>
<uuuga5$2s7td$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 16:35:10 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ea51c234139e61ddeb0e20c94eeecefb";
logging-data="2909767"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4g0IRAIUkcfcN9sp4E2QyfzECmDZva+c="
Cancel-Lock: sha1:qBH15I8sLltpO86qLyz+0jryvu8=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
 by: Michael S - Sun, 7 Apr 2024 16:35 UTC

On Sun, 7 Apr 2024 18:06:29 +0200
David Brown <david.brown@hesbynett.no> wrote:

> On 07/04/2024 17:38, Michael S wrote:
> > On Sun, 7 Apr 2024 16:06:02 +0200
> > David Brown <david.brown@hesbynett.no> wrote:
> >
> >>
> >> Different people have different needs from C++, and use different
> >> features. If I were programming on a PC, I'd happily use
> >> std::map<> and the like. But I don't program on PC's, and I don't
> >> use std::map<>. If I needed something like that, I'd make my own
> >> class that fitted my requirements tightly - a factor of 10
> >> inefficiency is often fine on big systems, but not on the devices
> >> I work with.
> >>
> >> But that's all fine - use whatever you find useful from the
> >> language.
> >>
> >>
> >
> > Factor of 5-10 (mentioned in my other post) is quite rare and mostly
> > applies not to std::map vs custom implementation of RB or AVL tree,
> > but to std::map vs some form of hash, esp. when the nature of the
> > key is such that relatively simple hash function happens to have
> > good collision avoidance properties and when the database is huge,
> > so O(1) vs O(logN) starts to be significant.
> >
>
> Sure.
>
> But remember, for small embedded systems you don't have dynamic
> memory - or if you do, you use it in limited and tightly controlled
> manner. And in a real-time system, it is the worst-case time that
> matters, unlike PC's where you are generally looking for average or
> amortized times. So a data structure which allocates and deallocates
> memory unpredictably, can use complex tree structures with little
> control of their worst-case times - no thanks!

As said in post above, in C++17 when the max size of map is known
during initialization, allocation and de-allocation can be solved by
std::map:extract in the same manner you do it for simpler containers:
you push the required number of nodes into std::map then immediately
extract and store in the simple structure, typically managed like a
stack, but probably not using std::stack. Then during main runtime,
in very typical "embedded" manner, you pop nodes that you want to
insert from stack and push extracted nodes back to stack. No malloc, no
free.
It was possibly to achieve similar effect before C++17 as well, but it
required use of custom allocators which are, IMHO, too hard to use.

>
> (And again, that does not mean these containers are not great choices
> for all kinds of other uses.)
>

Partially balanced binary trees, like those used by std::map and by its
relatives, are among the most predictable data structures out here.
Certainly they are far more predictable than generic hash that in the
worst case degenerates into O(N).
OTOH, in std::map of given size the difference in worst access time
between perfectly balanced case and most unbalanced case is only
2x. And that applies not just for lookup, but for insertion and
deletion as well.

Re: std::map advocacy

<20240407194845.0000218c@yahoo.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3522&group=comp.lang.c%2B%2B#3522

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5...@yahoo.com (Michael S)
Newsgroups: comp.lang.c++
Subject: Re: std::map advocacy
Date: Sun, 7 Apr 2024 19:48:45 +0300
Organization: A noiseless patient Spider
Lines: 55
Message-ID: <20240407194845.0000218c@yahoo.com>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad>
<uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com>
<uuu98b$2qou0$1@dont-email.me>
<20240407183854.00000797@yahoo.com>
<AyzQN.166158$46Te.62838@fx38.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 16:48:49 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ea51c234139e61ddeb0e20c94eeecefb";
logging-data="2909767"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+YTS6DTQhHu+1uxoOBxdxdqoeWwEqcmbc="
Cancel-Lock: sha1:/5MDHIMVlJ2XjLg0xFwVPLxfZ3M=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
 by: Michael S - Sun, 7 Apr 2024 16:48 UTC

On Sun, 07 Apr 2024 16:09:04 GMT
scott@slp53.sl.home (Scott Lurndal) wrote:

> Michael S <already5chosen@yahoo.com> writes:
> >On Sun, 7 Apr 2024 16:06:02 +0200
> >David Brown <david.brown@hesbynett.no> wrote:
> >
> >>
> >> Different people have different needs from C++, and use different
> >> features. If I were programming on a PC, I'd happily use
> >> std::map<> and the like. But I don't program on PC's, and I don't
> >> use std::map<>. If I needed something like that, I'd make my own
> >> class that fitted my requirements tightly - a factor of 10
> >> inefficiency is often fine on big systems, but not on the devices
> >> I work with.
> >>
> >> But that's all fine - use whatever you find useful from the
> >> language.
> >>
> >>
> >
> >Factor of 5-10 (mentioned in my other post) is quite rare and mostly
> >applies not to std::map vs custom implementation of RB or AVL tree,
> >but to std::map vs some form of hash, esp. when the nature of the
> >key is such that relatively simple hash function happens to have good
> >collision avoidance properties and when the database is huge, so O(1)
> >vs O(logN) starts to be significant.
>
> The biggest problem I have with std::map is that you cannot
> define a compile time map. For the application where we use
> map, the maps can be quite large (hundreds or thousands of entries)
> and initialization of those maps impacts application startup time
> significantly (several hundred distinct maps).
>
> We're planning on replacing std::map with a custom class optimized
> to efficiently handle the data (mmap'd disk file generated by
> a python script). A binary search on the primary key is the likely
> search algorithm. The maps don't change during application
> execution.
>

std::map is known to not be the best data structure for static search.
Not too bad, but not the best.

If you have the case where good hash function does not exist (which is
extremely rare) then in your scenario simple sorted vector + binary
search will likely be 1.5-2 times faster than std::map. Also when both
key and payload are small, vector can be non-trivially more
compact than map.

Nowadays the best structures probably have to take into account cache
hierarchy, so fat nodes are somewhat better than simple binary search,
but that level of advancement should be used only when speed is VERY
important.

Re: Ain't that beautiful ?

<uuulgg$2tk05$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3523&group=comp.lang.c%2B%2B#3523

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sun, 7 Apr 2024 19:35:12 +0200
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <uuulgg$2tk05$1@raubtier-asyl.eternal-september.org>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<cone.1712275227.292802.483430.1004@monster.email-scan.com>
<CuHPN.189578$taff.30721@fx41.iad> <20240405174448.00001e50@yahoo.com>
<uup59h$1esu3$2@raubtier-asyl.eternal-september.org>
<20240405183723.0000585f@yahoo.com>
<uup7dg$1febk$1@raubtier-asyl.eternal-september.org>
<uusjso$2bl1s$1@dont-email.me>
<uuteen$2kq8k$2@raubtier-asyl.eternal-september.org>
<hizQN.166156$46Te.75316@fx38.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 17:35:12 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="700d8c77c3a1204baa8bd911c63ba530";
logging-data="3067909"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18PY0AiDdftRdm7c4G/puydysEOEhU7E2k="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:2Wh2MaIYL9r+9TnQTDElLvfSKlo=
Content-Language: de-DE
In-Reply-To: <hizQN.166156$46Te.75316@fx38.iad>
 by: Bonita Montero - Sun, 7 Apr 2024 17:35 UTC

Am 07.04.2024 um 17:51 schrieb Scott Lurndal:
> Bonita Montero <Bonita.Montero@gmail.com> writes:
>> Am 07.04.2024 um 00:55 schrieb Chris M. Thomasson:
>>> On 4/5/2024 9:04 AM, Bonita Montero wrote:
>>>> Am 05.04.2024 um 17:37 schrieb Michael S:
>>>>
>>>>> However I know enough to know that Win32 is defined in terms of C.
>>>>> So I don't quite understand how XHANDLE can be part of it.
>>>>
>>>> It's obvious.
>>>>
>>>
>>> Where is XHANDLE defined wrt any Microsoft documentation? Its not:
>>
>> It's obvious that XHANDE is some kind of RAII-wrapper.
>
> https://www.logicallyfallacious.com/logicalfallacies/Appeal-to-Self-evident-Truth
>

My XHANDLE has nearly the same name like a HANDLE and takes a HANDLE
as its constructor parameter, so this is obvious.

Re: Ain't that beautiful ?

<uuuli3$2tk05$2@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3524&group=comp.lang.c%2B%2B#3524

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sun, 7 Apr 2024 19:36:03 +0200
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <uuuli3$2tk05$2@raubtier-asyl.eternal-september.org>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com>
<uuub65$2r67g$1@raubtier-asyl.eternal-september.org>
<20240407184156.00006d7b@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 17:36:03 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="700d8c77c3a1204baa8bd911c63ba530";
logging-data="3067909"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Hx3Oy5PVoHs1AVONrcFTx0ihQKuuFLGg="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:A57c6Db27jZDSxDIw23jRmebkdw=
In-Reply-To: <20240407184156.00006d7b@yahoo.com>
Content-Language: de-DE
 by: Bonita Montero - Sun, 7 Apr 2024 17:36 UTC

Am 07.04.2024 um 17:41 schrieb Michael S:
> On Sun, 7 Apr 2024 16:39:02 +0200
> Bonita Montero <Bonita.Montero@gmail.com> wrote:
>
>> Am 07.04.2024 um 15:00 schrieb Michael S:
>>
>>> $ gcc -c -Wall -O2 foo.cpp raii-foo.cpp
>>> $ size *.o
>>> text data bss dec hex filename
>>> 136 0 0 136 88 foo.o
>>> 172 0 0 172 ac raii-foo.o
>>>
>>
>> That's because of the unrolling code for exceptions. But this
>> unrolling code is separate and usually not executed. The code
>> path for the non-exceptional case should have the same perfor-
>> mance.
>>
>
> Didn't I say it myself about low runtime cost?
>
>

I think there's no additional runtime cost over manual releases
at all if no exception is thrown.

Re: Ain't that beautiful ?

<uuuln6$2tk05$3@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3525&group=comp.lang.c%2B%2B#3525

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sun, 7 Apr 2024 19:38:46 +0200
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <uuuln6$2tk05$3@raubtier-asyl.eternal-september.org>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com> <uuu98b$2qou0$1@dont-email.me>
<20240407183728.00000ac4@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 17:38:47 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="700d8c77c3a1204baa8bd911c63ba530";
logging-data="3067909"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19aRqybQw3ZkzczN1S32ZbKDPcdM9683uQ="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:oM0quccZMxeYSe3oLXx5ZWLKCVg=
In-Reply-To: <20240407183728.00000ac4@yahoo.com>
Content-Language: de-DE
 by: Bonita Montero - Sun, 7 Apr 2024 17:38 UTC

Am 07.04.2024 um 17:37 schrieb Michael S:

> RTTI plays no role here.
> Is not RTTI supported only for classes with virtual functions?

Destructors may be virutal but while unwinding the type of the
destructed object is known so ther's no need to call the destructor
virtually.

> In particular, classes with big number of members are used by lazy
> programmers to have what is in effect global variables without feeling
> guilty.

This may apply to static methods only.

Re: std::map advocacy

<uuum1i$2tk05$4@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3526&group=comp.lang.c%2B%2B#3526

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: std::map advocacy
Date: Sun, 7 Apr 2024 19:44:18 +0200
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <uuum1i$2tk05$4@raubtier-asyl.eternal-september.org>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com> <uuu98b$2qou0$1@dont-email.me>
<20240407183854.00000797@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 17:44:19 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="700d8c77c3a1204baa8bd911c63ba530";
logging-data="3067909"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18u29Iwq670cWrWGH/xmsiuSofrVKUnV7U="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:taMhIx9Oy+DyIODxELYQm/6S3Zg=
Content-Language: de-DE
In-Reply-To: <20240407183854.00000797@yahoo.com>
 by: Bonita Montero - Sun, 7 Apr 2024 17:44 UTC

Am 07.04.2024 um 17:38 schrieb Michael S:

> Factor of 5-10 (mentioned in my other post) is quite rare and mostly
> applies not to std::map vs custom implementation of RB or AVL tree, ...

That's nonsense. If the tree type is the same the performance is the
same. The high overhead of a tree comes from the pointer chasing while
looking up a certain node. The issue is the same for manual implemen-
tations.
What could make a map slow is the memory allocation part, but you could
either chose a fast allocator like mimalloc or use a C++23 flat_map,
where insertion or removal is as fast as possible.

> In this case I happened to have enough time to rewrite it in C with
> my own implementation of AVL tree. My own code was only some 10 or
> 15% faster than std container's. ...

I also prefer AVL-trees over RB-trees for the faster lookup, but if
the type of tree is the same and the memory allocation part is the
same there should be no performance difference between a manual C
-implementation and a std::map.

Re: std::map advocacy

<uuum49$2tk05$5@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3527&group=comp.lang.c%2B%2B#3527

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: std::map advocacy
Date: Sun, 7 Apr 2024 19:45:45 +0200
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <uuum49$2tk05$5@raubtier-asyl.eternal-september.org>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com> <uuu98b$2qou0$1@dont-email.me>
<20240407183854.00000797@yahoo.com> <AyzQN.166158$46Te.62838@fx38.iad>
<20240407194845.0000218c@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 17:45:45 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="700d8c77c3a1204baa8bd911c63ba530";
logging-data="3067909"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19YlU/6UQIITQaAFMytQ3h48zSjlipuDEc="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:t80DFeOlYNz9mbzwGMlxKHGSaZY=
In-Reply-To: <20240407194845.0000218c@yahoo.com>
Content-Language: de-DE
 by: Bonita Montero - Sun, 7 Apr 2024 17:45 UTC

Am 07.04.2024 um 18:48 schrieb Michael S:

> If you have the case where good hash function does not exist (which
> is extremely rare) then in your scenario simple sorted vector + binary
> search will likely be 1.5-2 times faster than std::map. Also when both
> key and payload are small, vector can be non-trivially more
> compact than map.

Use a flat_map and you'll get near to the lookup performance of a sorted
vector but you'll have superior insertion or removal performance.

Re: Ain't that beautiful ?

<uuurom$2utdf$2@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3528&group=comp.lang.c%2B%2B#3528

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sun, 7 Apr 2024 12:21:58 -0700
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <uuurom$2utdf$2@dont-email.me>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<cone.1712275227.292802.483430.1004@monster.email-scan.com>
<CuHPN.189578$taff.30721@fx41.iad> <20240405174448.00001e50@yahoo.com>
<uup59h$1esu3$2@raubtier-asyl.eternal-september.org>
<20240405183723.0000585f@yahoo.com>
<uup7dg$1febk$1@raubtier-asyl.eternal-september.org>
<uusjso$2bl1s$1@dont-email.me>
<uuteen$2kq8k$2@raubtier-asyl.eternal-september.org>
<hizQN.166156$46Te.75316@fx38.iad>
<uuulgg$2tk05$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 19:21:59 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7c328506b30cc464995f07533aa90da6";
logging-data="3110319"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18tmxQCyTVfruoTHbNKfNjvHQ3GqOVMoKw="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:tyc5jG3tNlLK3IhAR/3SxPjNN0U=
Content-Language: en-US
In-Reply-To: <uuulgg$2tk05$1@raubtier-asyl.eternal-september.org>
 by: Chris M. Thomasson - Sun, 7 Apr 2024 19:21 UTC

On 4/7/2024 10:35 AM, Bonita Montero wrote:
> Am 07.04.2024 um 17:51 schrieb Scott Lurndal:
>> Bonita Montero <Bonita.Montero@gmail.com> writes:
>>> Am 07.04.2024 um 00:55 schrieb Chris M. Thomasson:
>>>> On 4/5/2024 9:04 AM, Bonita Montero wrote:
>>>>> Am 05.04.2024 um 17:37 schrieb Michael S:
>>>>>
>>>>>> However I know enough to know that Win32 is defined in terms of C.
>>>>>> So I don't quite understand how XHANDLE can be part of it.
>>>>>
>>>>> It's obvious.
>>>>>
>>>>
>>>> Where is XHANDLE defined wrt any Microsoft documentation? Its not:
>>>
>>> It's obvious that XHANDE is some kind of RAII-wrapper.
>>
>> https://www.logicallyfallacious.com/logicalfallacies/Appeal-to-Self-evident-Truth
>>
>
> My XHANDLE has nearly the same name like a HANDLE and takes a HANDLE
> as its constructor parameter, so this is obvious.

I was just wondering if it was actually a CHandle, or what.

Re: Ain't that beautiful ?

<10734958976ed3ce8ea3a9c8c4a7ece9be334efb.camel@gmail.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3529&group=comp.lang.c%2B%2B#3529

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: wynii...@gmail.com (wij)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Mon, 08 Apr 2024 07:47:28 +0800
Organization: A noiseless patient Spider
Lines: 78
Message-ID: <10734958976ed3ce8ea3a9c8c4a7ece9be334efb.camel@gmail.com>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
<dodQN.493622$yEgf.114692@fx09.iad>
<uurtih$26abt$1@raubtier-asyl.eternal-september.org>
<daec0e1e768af35c82b6528119b8fc7385c780b2.camel@gmail.com>
<uutedl$2kq8k$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Date: Sun, 07 Apr 2024 23:47:29 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="45c95a1ed6159c0e8e8c29fc96882f73";
logging-data="3227337"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+YuQk0ZSqsJhUaXKgqYmke"
User-Agent: Evolution 3.50.2 (3.50.2-1.fc39)
Cancel-Lock: sha1:EfTTrjjOdC26eTJN9yXUo0706/Q=
In-Reply-To: <uutedl$2kq8k$1@raubtier-asyl.eternal-september.org>
 by: wij - Sun, 7 Apr 2024 23:47 UTC

On Sun, 2024-04-07 at 08:28 +0200, Bonita Montero wrote:
> Am 06.04.2024 um 21:00 schrieb wij:
> > On Sat, 2024-04-06 at 18:34 +0200, Bonita Montero wrote:
> > > Am 06.04.2024 um 16:56 schrieb Scott Lurndal:
> > >
> > > > For the most part true of std::vector.   Not necessarily for
> > > > std::map.
> > >
> > I estimate ::hsearch(...) is about 20 times faster than std::map, that says it all,
> > although the key is limited to c-string.
>
>
> A tree is slow, but if you need to iterate with key order there's
> nothing faster. Hash-maps are O(1) are faster but you can't traverse
> the KVs in key-order.
>
> >
> > > Show me a better key-value data structure when you
> > > also need to iterate through the KVs in sorting order.
> > >
> > > > Poorly used, templates increase the code footprint, ...
> > >
> > > They're fast and the code-foooprint may not be tolerable only on very
> > > small systems.
> > >
> >
> > One of the worst part of C++ is memory consumption, compared with C.
>
> C++ is not known for its bad memory consumption.
>
> > Let's say C program can solve problems of size X, C++ normally solves of size X/2.
> > This is equivalent to time performance in larger size.
> >
> > > > There is a definite run-time cost to using exceptions.  And some
> > > > C++ code (operating systems, hypervisors) don't have the
> > > > run-time infrastructure to support exception handling and stack
> > > > unwinding.
> > >
> > > Then don't throw exceptions through that foreign code. I'm often using
> > > lambdas without captures as callbacks to C-interfaces with Win32. With
> > > these callback's I can't use exceptions but that's not a problem.
> > >
> >
> > The problem of 'throw' is context-loss and time cost. For context-loss, you generally
> > won't be able to have library-level reusable codes. 'Throw' is normally one thousand
> > times slower than return, this part is, generally speaking, doomed.
>
> Exceptions are only thrown in exceptional cases like I/O-errors or a
> memory collapse. That happens very rarely and performance of thrown
> exceptions doens't count.
>

Don't be that exclusive. Throwing error is not that bad. Throwing error is like
setting global errno and executing 'soft' assertion failure.

> >
> > The problem of std::exception family is simply unnecessarily complex.
> >
> > > > Useful, but can easily be abused (e.g. for locking).
> > >
> > > Ok, "can be abused", then drop it ! ;-)
> > >
> > >
> >
> >
>

Re: std::map advocacy

<20240408111535.0000477e@yahoo.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3530&group=comp.lang.c%2B%2B#3530

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5...@yahoo.com (Michael S)
Newsgroups: comp.lang.c++
Subject: Re: std::map advocacy
Date: Mon, 8 Apr 2024 11:15:35 +0300
Organization: A noiseless patient Spider
Lines: 63
Message-ID: <20240408111535.0000477e@yahoo.com>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad>
<uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com>
<uuu98b$2qou0$1@dont-email.me>
<20240407183854.00000797@yahoo.com>
<uuum1i$2tk05$4@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 08 Apr 2024 08:15:39 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="baa660c573e71774a4976de4b6199f48";
logging-data="3548637"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19/gE6qb9WslbyTHB06YvakRA9AY5uLKRM="
Cancel-Lock: sha1:vc2KNaOjHRxu18ssbpR8XnM1xzs=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
 by: Michael S - Mon, 8 Apr 2024 08:15 UTC

On Sun, 7 Apr 2024 19:44:18 +0200
Bonita Montero <Bonita.Montero@gmail.com> wrote:

> Am 07.04.2024 um 17:38 schrieb Michael S:
>
> > Factor of 5-10 (mentioned in my other post) is quite rare and mostly
> > applies not to std::map vs custom implementation of RB or AVL tree,
> > ...
>
> That's nonsense. If the tree type is the same the performance is the
> same. The high overhead of a tree comes from the pointer chasing while
> looking up a certain node. The issue is the same for manual implemen-
> tations.

What exactly is nonsense?
You are saying approximately the same that I said above.

> What could make a map slow is the memory allocation part, but you
> could either chose a fast allocator like mimalloc or use a C++23
> flat_map, where insertion or removal is as fast as possible.
>

I didn't look at flat_map yet. I hate to leave leading edge of the
language.
In the case that I described in the other post allocation was solved by
extract() and pool of nodes. Worked great because in this particular
application there were a lot of insertions and deletions, but they
perfectly balanced each other and total size of multiset remained
constant (+-1) for majority of its life time.

> > In this case I happened to have enough time to rewrite it in C with
> > my own implementation of AVL tree. My own code was only some 10 or
> > 15% faster than std container's. ...
>
> I also prefer AVL-trees over RB-trees for the faster lookup,

Since my application was very modification-intensive, from algorithmic
perspective AVL is probably slightly worse than RB. I did AVL not
because of algorithmic superiority, but because I understand it better.

> but if
> the type of tree is the same and the memory allocation part is the
> same there should be no performance difference between a manual C
> -implementation and a std::map.
>

In my particular case of 2K to 10K nodes it was indeed almost the
same. But for bigger size, e.g. 1M to 10M, manual implementation could
be significantly faster, because nodes could be made significantly
smaller, improving cache hit rates.
That applies to set/multiset more than to map/multimap and to small
keys more than to big keys.

On x86-64 with MSVC/gcc/clang each std::set/multiset node occupies 32
bytes even when key is only 32 bits. With manual code+custom allocator+
knowledge that size of set never exceeds 4G nodes, the size of node
could be reduced to 16 bytes, still with 2 or 3 bytes to spare. Whether
it makes significant difference in speed or not, depends on exact size
of your set, on your hardware, on your access pattern, etc... But it
surely *could* make a difference.

Re: std::map advocacy

<uv0dd7$3diif$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3531&group=comp.lang.c%2B%2B#3531

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c++
Subject: Re: std::map advocacy
Date: Mon, 8 Apr 2024 11:29:11 +0200
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <uv0dd7$3diif$1@dont-email.me>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com> <uuu98b$2qou0$1@dont-email.me>
<20240407183854.00000797@yahoo.com> <uuuga5$2s7td$2@dont-email.me>
<20240407193505.00004d17@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 08 Apr 2024 09:29:11 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="f1b85236b74549e1358dd0118d839d2b";
logging-data="3590735"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX192bgKu+wm3JOrhjP6voFGJiyxOodHZvMk="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.11.0
Cancel-Lock: sha1:PaCD6yTApZUHtIoVgVBEc9Rm8X4=
Content-Language: en-GB
In-Reply-To: <20240407193505.00004d17@yahoo.com>
 by: David Brown - Mon, 8 Apr 2024 09:29 UTC

On 07/04/2024 18:35, Michael S wrote:

> Partially balanced binary trees, like those used by std::map and by its
> relatives, are among the most predictable data structures out here.
> Certainly they are far more predictable than generic hash that in the
> worst case degenerates into O(N).
> OTOH, in std::map of given size the difference in worst access time
> between perfectly balanced case and most unbalanced case is only
> 2x. And that applies not just for lookup, but for insertion and
> deletion as well.
>

As far as I know, details of how containers such as std::map are
implemented are left to the implementation - they are not guaranteed by
the standards.

Different types of systems have different needs. C++ supports a huge
range of uses, and for some of them, many parts of the standard library
are simply out of the question. The point was just that claims such as
Bonita's that "it is impossible to use C++ without exception[s]", or
that if you don't use the standard library you are "missing most of
C++", are just ignorant nonsense. People can choose what they need
based on a range of requirements and preferences, and that's exactly
what we want from a general-purpose language.

Re: std::map advocacy

<20240408133457.000005a9@yahoo.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3532&group=comp.lang.c%2B%2B#3532

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5...@yahoo.com (Michael S)
Newsgroups: comp.lang.c++
Subject: Re: std::map advocacy
Date: Mon, 8 Apr 2024 13:34:57 +0300
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <20240408133457.000005a9@yahoo.com>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad>
<uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com>
<uuu98b$2qou0$1@dont-email.me>
<20240407183854.00000797@yahoo.com>
<uuuga5$2s7td$2@dont-email.me>
<20240407193505.00004d17@yahoo.com>
<uv0dd7$3diif$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 08 Apr 2024 10:35:02 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="baa660c573e71774a4976de4b6199f48";
logging-data="3548637"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19pFK0MLnfwk1cdDR/15/JGWTE3tRH5Pwc="
Cancel-Lock: sha1:vbl3+9AGkgPthvfzFa8qZxY60vY=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
 by: Michael S - Mon, 8 Apr 2024 10:34 UTC

On Mon, 8 Apr 2024 11:29:11 +0200
David Brown <david.brown@hesbynett.no> wrote:

> On 07/04/2024 18:35, Michael S wrote:
>
> > Partially balanced binary trees, like those used by std::map and by
> > its relatives, are among the most predictable data structures out
> > here. Certainly they are far more predictable than generic hash
> > that in the worst case degenerates into O(N).
> > OTOH, in std::map of given size the difference in worst access time
> > between perfectly balanced case and most unbalanced case is only
> > 2x. And that applies not just for lookup, but for insertion and
> > deletion as well.
> >
>
> As far as I know, details of how containers such as std::map are
> implemented are left to the implementation - they are not guaranteed
> by the standards.
>
> Different types of systems have different needs. C++ supports a huge
> range of uses, and for some of them, many parts of the standard
> library are simply out of the question. The point was just that
> claims such as Bonita's that "it is impossible to use C++ without
> exception[s]", or that if you don't use the standard library you are
> "missing most of C++", are just ignorant nonsense. People can choose
> what they need based on a range of requirements and preferences, and
> that's exactly what we want from a general-purpose language.
>

My opinion about standard library is very close to that Bonita, even if
possibly possibly for the opposite reasons.
IMHO, if you can't make good use of either C++ Standard library or of
the other key feature of the language - virtual functions, then it is
wiser to avoid C++ altogether.
BTW, I *don't* use C++ on small embedded targets. More so, I don't use
it on moderately-sized embedded targets, say, 8-16 MB of RAM, 100-200
MHz CPU, but without protected memory and without full-featured OS.
My reasons are more psychological/managerial than technical - to keep
away developers with wrong mindsets and to prevent those that I can't
keep away from turning wrongest parts of their mindsets to full volume.

Re: std::map advocacy

<uv0jb2$ck7p$3@i2pn2.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3533&group=comp.lang.c%2B%2B#3533

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!.POSTED!not-for-mail
From: rich...@damon-family.org (Richard Damon)
Newsgroups: comp.lang.c++
Subject: Re: std::map advocacy
Date: Mon, 8 Apr 2024 07:10:26 -0400
Organization: i2pn2 (i2pn.org)
Message-ID: <uv0jb2$ck7p$3@i2pn2.org>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com> <uuu98b$2qou0$1@dont-email.me>
<20240407183854.00000797@yahoo.com> <uuuga5$2s7td$2@dont-email.me>
<20240407193505.00004d17@yahoo.com> <uv0dd7$3diif$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 8 Apr 2024 11:10:26 -0000 (UTC)
Injection-Info: i2pn2.org;
logging-data="413945"; mail-complaints-to="usenet@i2pn2.org";
posting-account="diqKR1lalukngNWEqoq9/uFtbkm5U+w3w6FQ0yesrXg";
User-Agent: Mozilla Thunderbird
X-Spam-Checker-Version: SpamAssassin 4.0.0
Content-Language: en-US
In-Reply-To: <uv0dd7$3diif$1@dont-email.me>
 by: Richard Damon - Mon, 8 Apr 2024 11:10 UTC

On 4/8/24 5:29 AM, David Brown wrote:
> On 07/04/2024 18:35, Michael S wrote:
>
>> Partially balanced binary trees, like those used by std::map and by its
>> relatives, are among the most predictable data structures out here.
>> Certainly they are far more predictable than generic hash that in the
>> worst case degenerates into O(N).
>> OTOH, in std::map of given size the difference in worst access time
>> between perfectly balanced case and most unbalanced case is only
>> 2x. And that applies not just for lookup, but for insertion and
>> deletion as well.
>>
>
> As far as I know, details of how containers such as std::map are
> implemented are left to the implementation - they are not guaranteed by
> the standards.
>
> Different types of systems have different needs.  C++ supports a huge
> range of uses, and for some of them, many parts of the standard library
> are simply out of the question.  The point was just that claims such as
> Bonita's that "it is impossible to use C++ without exception[s]", or
> that if you don't use the standard library you are "missing most of
> C++", are just ignorant nonsense.  People can choose what they need
> based on a range of requirements and preferences, and that's exactly
> what we want from a general-purpose language.
>

The Standard gives complexity guarantees for some operations on most
containers which largely limit what sort of method can be used by each
of them.

Re: std::map advocacy

<1bed53172895b75b7233785a3657cc938b2756dd.camel@gmail.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3534&group=comp.lang.c%2B%2B#3534

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: wynii...@gmail.com (wij)
Newsgroups: comp.lang.c++
Subject: Re: std::map advocacy
Date: Mon, 08 Apr 2024 19:18:06 +0800
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <1bed53172895b75b7233785a3657cc938b2756dd.camel@gmail.com>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com> <uuu98b$2qou0$1@dont-email.me>
<20240407183854.00000797@yahoo.com> <uuuga5$2s7td$2@dont-email.me>
<20240407193505.00004d17@yahoo.com> <uv0dd7$3diif$1@dont-email.me>
<20240408133457.000005a9@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Date: Mon, 08 Apr 2024 11:18:08 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="45c95a1ed6159c0e8e8c29fc96882f73";
logging-data="3636625"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+nF9v8wK4NKmkUzyBRg5iv"
User-Agent: Evolution 3.50.2 (3.50.2-1.fc39)
Cancel-Lock: sha1:vYsFWwnoxht9mUlU/807eXKvZQ8=
In-Reply-To: <20240408133457.000005a9@yahoo.com>
 by: wij - Mon, 8 Apr 2024 11:18 UTC

On Mon, 2024-04-08 at 13:34 +0300, Michael S wrote:
> On Mon, 8 Apr 2024 11:29:11 +0200
> David Brown <david.brown@hesbynett.no> wrote:
>
> > On 07/04/2024 18:35, Michael S wrote:
> >
> > > Partially balanced binary trees, like those used by std::map and by
> > > its relatives, are among the most predictable data structures out
> > > here. Certainly they are far more predictable than generic hash
> > > that in the worst case degenerates into O(N).
> > > OTOH, in std::map of given size the difference in worst access time
> > > between perfectly balanced case and most unbalanced case is only
> > > 2x. And that applies not just for lookup, but for insertion and
> > > deletion as well.
> > >  
> >
> > As far as I know, details of how containers such as std::map are
> > implemented are left to the implementation - they are not guaranteed
> > by the standards.
> >
> > Different types of systems have different needs.  C++ supports a huge
> > range of uses, and for some of them, many parts of the standard
> > library are simply out of the question.  The point was just that
> > claims such as Bonita's that "it is impossible to use C++ without
> > exception[s]", or that if you don't use the standard library you are
> > "missing most of C++", are just ignorant nonsense.  People can choose
> > what they need based on a range of requirements and preferences, and
> > that's exactly what we want from a general-purpose language.
> >
>
> My opinion about standard library is very close to that Bonita, even if
> possibly possibly for the opposite reasons.
> IMHO, if you can't make good use of either C++ Standard library or of
> the other key feature of the language - virtual functions, then it is
> wiser to avoid C++ altogether.

I would say that maybe you don't know how to use C++ effectively.
Ex1: I use my own C++ library (based on Clib), burden (learning, remembering,...) is super low.
all that user need to know are very reusable (c++ std-library has lots of things to learn that
are only meaningful in that library). E.g. my 'filesystem' is based on file descriptor, I don't
think what in the std c++ lib can beat mine (except it considers lots more usage environments).
Ex2: Qt is the software I admired since learn C++. It does not use std c++ library.

> BTW, I *don't* use C++ on small embedded targets. More so, I don't use
> it on moderately-sized embedded targets, say, 8-16 MB of RAM, 100-200
> MHz CPU, but without protected memory and without full-featured OS.
> My reasons are more psychological/managerial than technical - to keep
> away developers with wrong mindsets and to prevent those that I can't
> keep away from turning wrongest parts of their mindsets to full volume.
>
>
>
>

Re: std::map advocacy

<uv0mps$3fsqc$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3535&group=comp.lang.c%2B%2B#3535

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: std::map advocacy
Date: Mon, 8 Apr 2024 14:09:32 +0200
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <uv0mps$3fsqc$1@raubtier-asyl.eternal-september.org>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com> <uuu98b$2qou0$1@dont-email.me>
<20240407183854.00000797@yahoo.com>
<uuum1i$2tk05$4@raubtier-asyl.eternal-september.org>
<20240408111535.0000477e@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 08 Apr 2024 12:09:32 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="32ccdbdc79b4059c6c3faedc1f13b840";
logging-data="3666764"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18enXqXPz/kXdS4uFqC301pAkmlRKm0+6g="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:45EjsWL3udXWbCxHDd843M9e4x4=
Content-Language: de-DE
In-Reply-To: <20240408111535.0000477e@yahoo.com>
 by: Bonita Montero - Mon, 8 Apr 2024 12:09 UTC

Am 08.04.2024 um 10:15 schrieb Michael S:

> What exactly is nonsense?
> You are saying approximately the same that I said above.

You said that a cusom implementation of a RB- or AVL-tree is multiple
times faster. I said that this depends on the tree's properties because
you've got pointer chasing with trees; and you can't improve that with
a custom implementation.

> On x86-64 with MSVC/gcc/clang each std::set/multiset node occupies 32
> bytes even when key is only 32 bits. ...

There ar three pointers: to the parent and to the children and if a
RB-tree is used there's a flag that determines the colour of the node.
There's nothing to get around that.


devel / comp.lang.c++ / Re: Ain't that beautiful ?

Pages:1234
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor