Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Slow Performance while Selecting/Deselecting All Roles in User Doctype | GoodFirstPicks

Slow Performance while Selecting/Deselecting All Roles in User Doctype

frappe/frappe 0 comments 6d ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeFrappe / ERPNextPython

Why this is a good first issue

Performance degradation in role selection needs investigation and optimization.

AI Summary

The issue reports slow performance when selecting/deselecting roles in the User Doctype, especially noticeable with large numbers of roles. The problem requires performance profiling and optimization of the role selection mechanism. The regression since v15.87.0 suggests this may involve recent changes in the codebase.

Issue Description

Description of the issue

Select All and Unselect All buttons in User Doctype to select Role become slow as the number of roles increases.

For better systems with 16 GB RAM, it takes around 500 roles to see the slowness, but for 4GB systems, even for 200 roles, which is a reasonable amount of roles, it is extremely slow (takes around 5-10s).

The thing is, for the older version that I used to use, v15.87.0, it is fast even for similar number of users.

Context information (for bug reports)

Output of bench version

doppio 0.0.1
frappe 15.103.0
insights 3.2.18
lms 2.48.0

Steps to reproduce the issue

  1. Create around 500 test roles through the bench console
import frappe

count = 0
for i in range(1, 500):
    role_name = f"BUG_TEST_USER_{i:03d}"

    if not frappe.db.exists("Role", role_name):
        frappe.get_doc({"doctype": "Role", "role_name": role_name}).insert(ignore_permissions=True)
        count += 1

    frappe.db.commit()

print(f"Created {count} roles")

  1. Go to any User in the User Doctype
  2. Click Select All in the Roles & Permissions Tab
  3. You can observe the slowness. Note: It depends on the system RAM, systems with 4 GB RAM or less get impacted severely for even 200 users.
  4. Script to delete all test roles once tested through bench console
roles = frappe.get_all("Role", filters={"name": ["like", "BUG_TEST_USER_%"]}, pluck="name")
for role in roles:
    try:
        frappe.delete_doc("Role", role, ignore_permissions=True)
    except Exception:
        print("Skipping", role)
        continue
frappe.db.commit()
print(f"Deleted {len(roles)} test roles.")

Observed result

Takes around 5 seconds to select/deselect all roles.

Expected result

Should be immediate.

Additional information

MacOS, M3 Bare Metal Setup

https://github.com/user-attachments/assets/f4738b29-cd83-4c13-a331-39cb7f347f8d

GitHub Labels

performance

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!

Risk Flags

  • performance optimization
  • potential regression risk
Loading labels...

Details

Points20 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno