knowledge(performance): add community rules for JIT, locks, and false positives

These articles capture BC-specific mechanics agents still invert: partial-record JIT on writes, Reset clearing SetLoadFields, HttpClient inside write transactions, and batched number series, plus negative guidance that stops over-eager Query and IsEmpty "fixes".

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Stefano Demiliani 2026-08-20 15:57:58 +02:00
parent 841b4e7cab
commit ebceff2332
54 changed files with 1270 additions and 0 deletions

View file

@ -0,0 +1,28 @@
---
bc-version: [all]
domain: performance
keywords: [setloadfields, partial-record, jit-load, modify, insert, transferfields, write-path]
technologies: [al]
countries: [w1]
application-area: [all]
---
# Skip SetLoadFields on write and copy paths
> Contributions welcome — open a PR to refine or extend this article.
## Description
`SetLoadFields` is a read optimization. `Insert`, `Modify`, `Delete`, `Rename`, `TransferFields`, and copy into a temporary record all require a fully loaded row. When those operations run on a partial record, the platform issues a just-in-time load of the missing fields. That extra round-trip costs more than loading the full row on the original `FindSet` or `Get`. Agents that apply `use-setloadfields-for-partial-records.md` to every loop therefore make write loops slower, not faster.
## Best Practice
Use `SetLoadFields` only when the subsequent access is read-only. On a loop that writes the iterated record, or copies it with `TransferFields` / `Copy` onto a temporary record, omit `SetLoadFields` so the initial read already materializes every field those operations need.
See sample: `skip-setloadfields-on-write-and-transferfields.good.al`.
## Anti Pattern
Calling `SetLoadFields` immediately before a `FindSet` whose body `Modify`s, `Delete`s, `Rename`s, or `TransferFields`s the same record. The review signal is partial-record setup on a record variable that is written or copied in the same iteration, not the mere presence of `SetLoadFields` on a read-only loop.
See sample: `skip-setloadfields-on-write-and-transferfields.bad.al`.