Instruction file imported from Louage/frw-agentic-coding (
.github/instructions/al-performance.instructions.md). Copyright stays with the author.
AL Performance — Micro Rules
Hard safety-net rules. Patterns, AL0896 triage and examples live in skill-performance.
SetRange/SetFilterbeforeFind/FindSet/FindFirst. Filter early, do not process then filter.SetLoadFieldsbeforeGet/Findwhen only some columns are used. Order matters:SetLoadFields→SetRange→Find. Do not list primary-key fields — the platform loads them automatically; including them is dead weight (e.g.Customer.SetLoadFields("VIP Customer"), not("No.", "VIP Customer")).CalcSumsinstead of accumulation loops. If you need a total, do not iterate and sum — use the platform aggregation.- No database calls inside loops (
Get,FindFirst,CalcFieldsper record). Preload intoDictionary/temporaryor useSetAutoCalcFieldsbefore the loop. - One write per modified record: compute all changes in memory and issue a single
Modify(true).