Skip to content

Instantly share code, notes, and snippets.

@joseberlines
Created November 10, 2021 22:48
Show Gist options
  • Save joseberlines/05bbdf28aaf97327e63ceedf381b8606 to your computer and use it in GitHub Desktop.
Save joseberlines/05bbdf28aaf97327e63ceedf381b8606 to your computer and use it in GitHub Desktop.
100000.py
# 100000 elements list
L=[{'name':'e'+str(i), 'explanation':'objection1','law':(),'CS':('..claim','..notclear')} for i in range(100000)]
next(item for item in L if item["name"] == "e3")
# 716 ns ± 62.5 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
[d for d in L if d['name']=='e3'][0]
# 6.66 ms ± 520 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment