Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance: Optimize fs_accounts options loading on plugins page - Duplicate Queries #771

Open
bjoernzosel opened this issue Dec 10, 2024 · 0 comments

Comments

@bjoernzosel
Copy link

Current Behavior - UPDATE

Further analysis reveals that the fs_accounts query is being executed twice on each plugins page load:

SELECT autoload
FROM wp_options
WHERE option_name = 'fs_accounts'
LIMIT 1

Query execution data:

  • Each query takes ~0.0005s
  • 2 identical calls per page load
  • Called through update_option() in different locations:
    1. fs_dynamic_init()
    2. Freemius->load_account()

Additional Performance Impact

  • Duplicate database queries for the same data
  • Doubled execution time (~0.001s total)
  • Unnecessary database load
  • No in-memory data reuse between calls

Additional Optimization Suggestions

  1. Implement in-memory caching between function calls

    • Load data once during initialization
    • Store in class property or transient
    • Reuse for subsequent function calls
  2. Consolidate data loading functions

    • Single point of data retrieval
    • Share data between components
    • Avoid redundant database queries

This duplication compounds the performance issues outlined in the original report. Would you consider implementing both the original optimizations and measures to prevent duplicate queries?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant