wxHashMap vs. std::map

Dave Bee davebeeus at yahoo.com
Mon Sep 24 16:57:58 PDT 2007


--- Vadim Zeitlin <vadim at wxwidgets.org> wrote:

> On Mon, 24 Sep 2007 15:13:23 -0700 (PDT) Dave Bee
> <davebeeus at yahoo.com> wrote:
> 
> 
>  In fact as Michael wrote in a later reply, these
> classes have different
> performance characteristics in general. std::map is
> an ordered container while hash map isn't.

Oops. Sorry for missing Michael's reply (for some
reason I didn't receive it in my email account). You
(and Michael) are right, of course. I knew that
std:map is implemented using a balanced tree, but I
didn't know that wxHashMap isn't.

I thought that if wxHashMap is capable of something
like:

  h2["Bill"] = "ABC";

(as illustrated in the wx manual), then it must be
implemented just like std::map. Apparently I was
wrong.


>  std::string in VC7 and 8 uses small
> string optimization which wxString lacks so it could
> be much more efficient for small strings.

Thank your for this tip.

> 
>  Anyhow, if performance is really critical for you,
> you should write your
> own benchmarks (or use some existing ones) and look
> at the results.

Currently it is not critical. I was just curious and
asked the question in case the answer is already
known. I will certainly let you know when I perform
such benchmarks.

Thanks,
Dave



       
____________________________________________________________________________________
Moody friends. Drama queens. Your life? Nope! - their life, your story. Play Sims Stories at Yahoo! Games.
http://sims.yahoo.com/  




More information about the wx-users mailing list