Performance optimization

From hmislk/hmis · View interactive version

Performance optimization is an AI agent skill from the GitHub repository hmislk/hmis. Performance optimization patterns for the HMIS project. Use when optimizing slow queries, improving autocomplete performance, tuning database queries, reducing page load times, optimizing report generation, or investigating performance issues.

How to use this skill

Skill file

Performance Optimization Guide

Core Principles

  1. Use DTOs throughout - Avoid converting to entities until necessary
  2. Cache autocomplete results - Preserve full DTO data for converters
  3. Skip unnecessary operations - Use configuration and conditional logic
  4. Defer expensive operations - Move to background or later in workflow

Autocomplete Optimization (85-90% improvement)

Key pattern from Pharmacy Retail Sale (639ms -> 50ms):

  1. Enhance DTO with fields needed for lightweight entity creation
  2. Cache autocomplete results in controller for converter reuse
  3. Skip discount calculations when no discount scheme active
  4. Defer item instructions loading to later in workflow

Query Optimization

MySQL Performance

Report Optimization

🚨 Found a slow report? File an issue

Whenever a report is found slow (during testing, an investigation or a user

complaint), file a GitHub issue for it then, without waiting to be asked. The

one exception is a demonstrate-issues session: there, keep its review and

approval gate and file only after the user has reviewed the write-ups. A

report that times out makes users think its data is missing. The issue asks for:

cross-checked (as Stock Ledger does: "12. Stock Ledger" and "12. Stock Leger

(Legacy)").

Record the menu path, the filters used and how long it took. No hospital data

in the issue. One issue per report; search for an existing one first.

For detailed guides, read:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.