---
id: change/bcapps/11222
type: change
title: "#11222 Improve Low-Level Code Calculator performance"
summary: Low-Level Code Calculator performance improved by filtering out items without a Production BOM and replacing a List with a Dictionary for node key tracking, reducing calculation time significantly in real-world scenarios.
tier: official
language: en
tags:
  - performance
  - main
  - bc30
  - codeunit low-level code calculator
system: inventory
review:
  state: reviewed
  by: opus
  at: "2026-10-28T10:56:09.594Z"
  flags: []
generated:
  at: "2026-10-29T00:16:37.959Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 026e1e2120469e629b022c36b9dc02cd5980760c
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/11222
    title: "microsoft/BCApps#11222: Improve Low-Level Code Calculator performance"
    date: "2026-10-26"
    commit: 026e1e2120469e629b022c36b9dc02cd5980760c
    t: null
    quote: the combination of these changes reduced low-level code calculation time from roughly 10 hours to about 2 hours
links:
  learn: []
  objects:
    - object/codeunit/3687
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
  related:
    - to: https://learn.microsoft.com/dynamics365/business-central/dev-itpro/administration/optimize-sql-query-objects-and-performance
      title: Query Objects and Performance
      label: possibly related
      why: Low-level code calculator performance relates to query objects and database performance optimization.
      by: model
number: 11222
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/11222
kind: pr
base_branch: main
major: "30"
merged_at: "2026-10-26T10:05:53Z"
author: duiliotacconi
author_type: User
community_contribution: true
labels:
  - "ADO: Sync"
  - From Fork
  - "Team: SCM"
change_class: code
change_kind: performance
behavior_change: false
breaking: false
files:
  count: 1
  additions: 15
  deletions: 9
  al: 1
apps:
  - Base Application
objects_touched:
  - key: codeunit/3687
    page: codeunit/3687
    type: codeunit
    id: 3687
    name: Low-Level Code Calculator
    app: Base Application
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues:
  - 11223
work_items:
  - 654095
systems:
  - inventory
quote: the combination of these changes reduced low-level code calculation time from roughly 10 hours to about 2 hours
joined_against:
  major: "30"
  commit: 15385dede95a4f9e7be01be47c684fc9d654a7ce
---

# #11222 Improve Low-Level Code Calculator performance

> Low-Level Code Calculator performance improved by filtering out items without a Production BOM and replacing a List with a Dictionary for node key tracking, reducing calculation time significantly in real-world scenarios.

[Pull request](https://github.com/microsoft/BCApps/pull/11222) · merged into `main` (BC30) on 2026-10-26 by duiliotacconi (community contribution) · 1 file (+15 -9), 1 AL · performance · tier official · reviewed (checked by Opus)

## What changed

- Production BOM query now filters for non-empty BOM numbers before opening
- NodeKeysAddedToTree changed from List to Dictionary to improve lookup and insert performance from O(n) to near-constant
- Eliminates unnecessary cache invalidation and item loading for items without Production BOMs
- New extensibility point OnBeforeItemProductionBOMsOpen added to allow query customization
- Combined changes reduced calculation time from 10 hours to 2 hours in tested scenario

## AL objects touched

- [Codeunit 3687 "Low-Level Code Calculator"](../../objects/codeunit/3687.md), Base Application: modified

## Context

- Fixes: [#11223 Low-Level Code Calculator (codeunit 3687) is slow: processes items without a Production BOM and uses a List instead of a Dictionary](https://github.com/microsoft/BCApps/issues/11223) (closed)
- Work items: AB#654095
- Labels: ADO: Sync, From Fork, Team: SCM
- Systems: inventory
- From the description: "the combination of these changes reduced low-level code calculation time from roughly 10 hours to about 2 hours"

## Possibly related

No source states these links: they share an object, a model read them, or a person found the same subject.

- [Query Objects and Performance](https://learn.microsoft.com/dynamics365/business-central/dev-itpro/administration/optimize-sql-query-objects-and-performance) — possibly related: Low-level code calculator performance relates to query objects and database performance optimization. (model-linked)

Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).
