---
id: change/bcapps/9351
type: change
title: "#9351 [master]Subscription Billing: O(N²) contract-renewal detection in Sales-Post subscribers slows posting (~28% of batch CPU)"
summary: Contract renewal detection in the Subscription Billing Sales-Post subscribers was reworked to remove O(N²) behavior. Before the fix, this check took about 28% of batch posting CPU.
tier: official
language: en
tags:
  - performance
  - main
  - bc30
  - codeunit sub. contr. renewal subcribers
system: development
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:12:34.140Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: a6e62558641cd59ad4f8e59cb47b15d032b5d5a1
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/9351
    title: "microsoft/BCApps#9351: [master]Subscription Billing: O(N²) contract-renewal detection in Sales-Post subscribers slows posting (~28% of batch CPU)"
    date: "2026-07-16"
    commit: a6e62558641cd59ad4f8e59cb47b15d032b5d5a1
    t: null
    quote: null
links:
  learn: []
  objects:
    - object/codeunit/8001
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 9351
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/9351
kind: pr
base_branch: main
major: "30"
merged_at: "2026-07-16T12:32:13Z"
author: AndreasHans
author_type: User
community_contribution: false
labels:
  - "AL: Apps (W1)"
change_class: code
change_kind: performance
behavior_change: false
breaking: false
files:
  count: 1
  additions: 72
  deletions: 21
  al: 1
apps:
  - Subscription Billing
objects_touched:
  - key: codeunit/8001
    page: codeunit/8001
    type: codeunit
    id: 8001
    name: Sub. Contr. Renewal Subcribers
    app: Subscription Billing
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 640070
systems:
  - development
quote: null
joined_against:
  major: "30"
  commit: ecbc028c25dbe83b61313bc566e6c1d41184bb1c
---

# #9351 [master]Subscription Billing: O(N²) contract-renewal detection in Sales-Post subscribers slows posting (~28% of batch CPU)

> Contract renewal detection in the Subscription Billing Sales-Post subscribers was reworked to remove O(N²) behavior. Before the fix, this check took about 28% of batch posting CPU.

[Pull request](https://github.com/microsoft/BCApps/pull/9351) · merged into `main` (BC30) on 2026-07-16 by AndreasHans · 1 file (+72 -21), 1 AL · performance · tier official · reviewed (checked by Opus)

## What changed

- Contract renewal detection in the Sales-Post subscribers no longer scales quadratically
- The old check took about 28% of batch posting CPU
- The change is limited to codeunit 8001 Sub. Contr. Renewal Subcribers
- Intended to speed up sales posting when Subscription Billing is used

## AL objects touched

- [Codeunit 8001 "Sub. Contr. Renewal Subcribers"](../../objects/codeunit/8001.md), Subscription Billing: modified

## Context

- Work items: AB#640070
- Labels: AL: Apps (W1)
- Systems: development

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).
