Most efficient way to search in list of dicts : <p>I have the following list of dicts.</p>

<pre><code>people = [
{'name': "Tom", 'age': 10},
{'name': "Mark", 'age': 5},
{'name': "Pam", 'age': 7}
]
</code></pre>

<p>Which would be the most optimized way in terms of performance to search in list of dicts. Following are different some methods:</p>

<pre><code>next((item for item in dicts if item["name"] == "Pam"), None)
</code></pre>

<p>OR</p>

<pre><code>filter(lambda person: person['name'] == 'Pam', people)
</code></pre>

<p>OR</p>

<pre><code>def search(name):
    for p in people:
        if p['name'] == name:
            return p
</code></pre>

<p>OR</p>

<pre><code>def search_dictionaries(key, value, list_of_dictionaries):
    return [element for element in list_of_dictionaries if element[key] == value]
</code></pre>

<p>Any other method is also welcome. Thanks.</p>
