[sldev] Re: LLUUIDHashMap vs hash_map

Dale Glass dale at daleglass.net
Thu Sep 20 08:28:40 PDT 2007


On Thursday 20 September 2007 16:31:29 Douglas Soo wrote:
> Unless you are iterating or looking through objects EXTREMELY often
> (enough to show up as more than a couple percent of time in a time-based
> profile), I would stay far away from it.  It doesn't use any of the
> standard STL semantics for iteration, and is assuredly not thread-safe,
> or anything else that you'd really like.  In fact, unless there are
> performance or memory utilization reasons, I would convert the existing
> code away from using it.
>
> Also, hash_map isn't part of the official STL standard, so even though
> it's in common usage, I would stay away from it for portability reasons.
>  So, I would stick with a standard map unless you really need to iterate
> or look things up extremely frequently (> 10000 times/frame).
I'm looking at implementing a cache of object owners, to implement several 
features on top of that. Current uses:

Muting everything owned by an avatar when the avatar is muted. 

Keeping the info for my particle sources list (grid sends owner data for 
those IIRC)

Visible object search by owner, to allow people to find things like griefer 
cubes without having to have the corresponding land privileges.


All that shouldn't be anywhere near your 10000 times/frame figure, so I'll 
go with the map, then.

I know hash_map isn't standard, but I thought to use it because I thought 
it was used in the source, although turns out I didn't look well enough. 
It's #included in llstringtable.h and llhash.h but doesn't seem to be 
actually used anywhere. I'll put a patch on jira to remove those then.


>
> More about LLUUIDHashMap (for the interested):
> [snip]
Thanks a lot, that was very interesting.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.secondlife.com/pipermail/sldev/attachments/20070920/367d17a3/attachment-0001.pgp


More information about the SLDev mailing list