Skip to content

Commit

Permalink
bench: isolated list view
Browse files Browse the repository at this point in the history
  • Loading branch information
ankush committed Dec 16, 2024
1 parent 7fe66ee commit c241490
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions caffeination/microbenchmarks/bench_orm.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from functools import lru_cache

import frappe
from frappe.desk.reportview import get, get_count


def bench_get_doc():
Expand Down Expand Up @@ -42,6 +43,20 @@ def bench_get_list():
return frappe.get_list("Role", "*", limit=20, run=0)


def bench_list_view_query():
frappe.local.form_dict = {
"doctype": "Role",
"fields": '["`tabRole`.`name`","`tabRole`.`owner`","`tabRole`.`creation`","`tabRole`.`modified`","`tabRole`.`modified_by`" ,"`tabRole`.`_user_tags`","`tabRole`.`_comments`","`tabRole`.`_assign`","`tabRole`.`_liked_by`","`tabRole`.`docstatus`","`tabRole`.`idx`","`tabRole`.`disabled`"]',
"filters": "[]",
"order_by": "`tabRole`.creation desc",
"start": "0",
"page_length": "20",
"group_by": "",
"with_comment_count": "1",
}
return get()


def bench_get_all_with_filters():
return frappe.get_all("Role", {"creation": (">", "2020-01-01 00:00:00")}, "disabled", limit=10, run=0)

Expand Down

0 comments on commit c241490

Please sign in to comment.