About Store Forum Documentation Contact



Post Reply 
EE::Map find() Performance
Author Message
fatcoder Offline
Member

Post: #1
EE::Map find() Performance
I'm using EE:Map to store data with a Str key. I'm just wondering if the find() method is performance expensive?

Does it search through the map looking for the key value? If the desired key happens to be the last in the list, does it search the entire list before returning?

Or does Map use some sort of cached lookup or something internally to make find() calls fast?
03-31-2012 12:31 PM
Find all posts by this user Quote this message in a reply
PsychoBoy Offline
Member

Post: #2
RE: EE::Map find() Performance
03-31-2012 01:47 PM
Visit this user's website Find all posts by this user Quote this message in a reply
JonathonA Offline
Member

Post: #3
RE: EE::Map find() Performance
If you are looking for near instantaneous retrieval of data based on a key, try using a hash table; I've got an implementation that uses Esenthels memory containers if you require that... if that is what you are looking for of course smile
(This post was last modified: 03-31-2012 04:48 PM by JonathonA.)
03-31-2012 04:45 PM
Visit this user's website Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #4
RE: EE::Map find() Performance
Makes sense that its a binary search considering you need to supply a compare function. Nevertheless... I am in fact ideally looking for "instant" retrieval based on a string key. Thanks for the offer jonathon... I would definitely like to see your implementation. smile
03-31-2012 11:48 PM
Find all posts by this user Quote this message in a reply
JonathonA Offline
Member

Post: #5
RE: EE::Map find() Performance
Cool smile It needs refining but it works very well at the moment. Sent it to you via PM; if anyone else would like to use it please feel free to message me smile
(This post was last modified: 04-01-2012 01:15 AM by JonathonA.)
04-01-2012 01:01 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply