Sync knowledge articles with review agent instructions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Jesper Schulz-Wedde 2026-05-05 14:08:32 +02:00
parent f562fba837
commit 5bcdc55df9
62 changed files with 768 additions and 58 deletions

View file

@ -0,0 +1,26 @@
---
bc-version: [all]
domain: performance
keywords: [dictionary, temporary-table, lookup, identity, o1]
technologies: [al]
countries: [w1]
application-area: [all]
---
# Use Dictionary for temporary identity lookups
## Description
A temporary record is useful when code needs record semantics: filters, keys, FlowFields, or table-shaped buffers. When the only operation is "have I seen this key?" or "what value belongs to this key?", a `Dictionary` is the simpler and faster structure. Dictionary lookup is O(1) by key, while a temporary table still pays record and key-management overhead.
## Best Practice
Use `Dictionary` for in-memory lookup sets and maps whose keys fit in memory and whose access pattern is by identity. Keep temporary tables for data that needs table APIs, multiple keys, filter expressions, or later processing as records.
See sample: `use-dictionary-for-temporary-identity-lookups.good.al`.
## Anti Pattern
Creating a temporary table solely to call `Get` or `FindFirst` by a single key in a loop. The code looks familiar to AL developers, but it is heavier than the lookup problem requires.
See sample: `use-dictionary-for-temporary-identity-lookups.bad.al`.