-
Notifications
You must be signed in to change notification settings - Fork 214
Description
While integrating Dokan’s vendor dashboard navigation into a BuddyPress-based environment, we identified a severe performance issue caused by repeated option reads during dashboard navigation resolution.
Specifically, dokan_get_dashboard_nav() and dokan_get_navigation_url() are invoked repeatedly within the same request via VendorNavMenuChecker, resulting in extremely high-frequency calls to get_option() — particularly the dokan_pages option.
This does not cause a fatal error by itself, but it creates a hot path that significantly increases memory usage, CPU time, and page latency on vendor dashboard pages.
Observed Behavior (Before Patch)
dokan_pages option read 7,000+ times per request
Total option reads exceeded 190,000
Hot path trace consistently showed:
→ convert_to_react_menu
→ dokan_get_dashboard_nav
→ dokan_get_navigation_url
→ apply_filters recursion
Memory peak reached ~33MB+
Issue reproduced consistently on:
/dashboard/?path=/analytics/Overview
/store/
Screenshots:
Hot path - Shutdown Summary (counts + memory):

Environment :
- WordPress: 6.x
- Dokan Lite: develop branch (current as of Jan 2026)
- Dokan Pro: enabled
- BuddyPress: enabled
- PHP: 8.x
- Reproduced on clean reloads (non-AJAX)
Expected Behavior
Dashboard navigation resolution should:
Run at runtime (as designed)
Avoid repeated recomputation of the same navigation URLs within a single request
Avoid triggering excessive option reads that create hot paths
Behavior After Patch (PR #3067)
After applying the proposed changes:
Hot paths no longer occur
dokan_pages reads reduced to ~2,300
Total option reads reduced to ~8,800
Memory usage stabilized
Navigation behavior remains unchanged
No caching persists across requests (runtime behavior preserved)
Because the hot path no longer occurs, there is no equivalent “hot” log entry to capture. The absence of hot paths is the expected result.
Screenshots:
NO Hot Path - Shutdown Summary (counts + memory):

Why This Matters
Although this was identified while integrating with BuddyPress, the issue originates in Dokan core navigation resolution. Any environment that invokes dokan_get_dashboard_nav() and dokan_get_navigation_url() multiple times within a single request may encounter similar hot paths, increased memory pressure, and degraded page performance at scale.
Related PR
(#3067)
