Skip to content

Refactored Merge-DatumArray for performance optimization#175

Open
DoLearnWhileAlive wants to merge 6 commits into
gaelcolas:mainfrom
DoLearnWhileAlive:refactormergedatumarray
Open

Refactored Merge-DatumArray for performance optimization#175
DoLearnWhileAlive wants to merge 6 commits into
gaelcolas:mainfrom
DoLearnWhileAlive:refactormergedatumarray

Conversation

@DoLearnWhileAlive
Copy link
Copy Markdown
Contributor

  • Replaced O(n²) nested loop comparisons using Compare-Hashtable with O(n+m) hash-based indexing
  • Pre-computed knockout reference items to avoid repeated checks during merge
  • Changed output type from [System.Collections.ArrayList] to [System.Collections.Generic.List[object]]
  • Added private function Get-DatumTupleKeyValueString for consistent composite key generation
  • Added private function Test-DatumKnockout for efficient knockout matching
  • Removed private function Compare-Hashtable.ps1 (no longer needed)

@DoLearnWhileAlive
Copy link
Copy Markdown
Contributor Author

DoLearnWhileAlive commented May 28, 2026

PR is now ready for review.
For configuration data with many layers and many hashtable arrays it's a huge improvement. In my test case RSOP compilation for 1 node went down from 8 minutes to 3 seconds.

@DoLearnWhileAlive DoLearnWhileAlive force-pushed the refactormergedatumarray branch from abe0d71 to ed73019 Compare May 30, 2026 21:33
- Replaced O(n²) nested loop comparisons using `Compare-Hashtable` with
  O(n+m) hash-based indexing
- Pre-computed knockout reference items to avoid repeated checks during
  merge
- Changed output type from `[System.Collections.ArrayList]` to
  `[System.Collections.Generic.List[object]]`
- Added private function `Get-DatumTupleKeyValueString` for consistent
  composite key generation
- Added private function `Test-DatumKnockout` for efficient knockout
  matching
- Removed private function `Compare-Hashtable.ps1` (no longer needed)
to ensure also node specific Datum handler values from lower layers are
merged correctly.
otherwise follow-up nodes merge the same tuple key values as the first
node.
@DoLearnWhileAlive DoLearnWhileAlive force-pushed the refactormergedatumarray branch from ed73019 to 3d9cfc5 Compare May 30, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant