Skip to content

Commit

Permalink
bench: get_meta
Browse files Browse the repository at this point in the history
  • Loading branch information
ankush committed Jan 6, 2025
1 parent 85246aa commit 0b3c6c9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions caffeine/microbenchmarks/bench_orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ def bench_get_cached_doc():
return docs


def bench_get_meta():
for doctype in get_doctypes():
frappe.get_meta(doctype)
frappe.local.cache.clear()


def bench_get_local_cached_doc():
docs = []
doctype = "Role"
Expand Down Expand Up @@ -70,4 +76,9 @@ def get_all_roles():
return frappe.get_all("Role", order_by="creation asc", limit=10, pluck="name")


@lru_cache
def get_doctypes(limit=50):
return frappe.get_all("DocType", order_by="creation asc", limit=limit, pluck="name")


bench_doc_to_dict = NanoBenchmark("doc.as_dict()", setup='doc=frappe.get_doc("User", "Guest")')

0 comments on commit 0b3c6c9

Please sign in to comment.