Skip to content

perf: reduce parse node allocations when deserializing primitive types#1964

Merged
baywet merged 17 commits into
mainfrom
copilot/reduce-parse-node-allocations
Apr 16, 2026
Merged

perf: reduce parse node allocations when deserializing primitive types#1964
baywet merged 17 commits into
mainfrom
copilot/reduce-parse-node-allocations

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 12, 2026

  • Understand the existing code structure for JsonParseNode and FormParseNode
  • Add private getXXXValueFromRaw methods to both JsonParseNode and FormParseNode
  • Update public getXXXValue methods to delegate to private methods
  • Update getCollectionOfPrimitiveValues to maintain triage conditions but call private methods
  • Run tests to validate changes
  • Code review and security scan
  • Apply prettier formatting
  • Inline getBooleanValueFromRaw since it's only used once in getBooleanValue
  • Inline getNumberValueFromRaw since it's only used once in getNumberValue
  • Add unit tests for FormParseNode.getCollectionOfPrimitiveValues with types other than string
  • Clone Date instance in getDateValueFromRaw via new Date(value.getTime()) to preserve copy semantics
  • Update FormParseNode.getCollectionOfPrimitiveValues test descriptions to clarify string-only support
  • Convert private helper arrow functions to private class methods in JsonParseNode and FormParseNode (reduces per-instance allocations)
  • Restore conditional block in FormParseNode.getCollectionOfPrimitiveValues for future type-parameter support
Original prompt

This section details on the original issue you should resolve

<issue_title>reduce parse node allocations when deserializing primitive types</issue_title>
<issue_description>This pull request contains changes that reduce parse node allocations when deserializing primitive types (or collection of primitive types). Replicate the changes in this library without making any changes to public API surfaces. Use conventional commits</issue_description>

Comments on the Issue (you are @copilot in this section)


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

@baywet
Copy link
Copy Markdown
Member

baywet commented Mar 12, 2026

@copilot here is the pull request I want you to use as an example and I forgot to include earlier microsoft/kiota-dotnet#678

Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix parse node allocations during primitive type deserialization perf: reduce parse node allocations when deserializing primitive types Mar 12, 2026

This comment was marked as outdated.

baywet

This comment was marked as outdated.

@github-project-automation github-project-automation Bot moved this to In Progress 🚧 in Kiota Mar 12, 2026
…ormParseNode

- Add private getXXXValueFromRaw methods that accept the raw value (not a parse node)
- Update public getXXXValue methods to delegate to the new private methods
- Update getCollectionOfPrimitiveValues to maintain triage conditions but call private methods directly instead of allocating intermediate parse nodes

Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>

This comment was marked as outdated.

Copilot AI requested a review from baywet March 12, 2026 18:25
@baywet baywet marked this pull request as ready for review March 17, 2026 13:47
@baywet baywet requested a review from a team as a code owner March 17, 2026 13:47
@baywet baywet requested a review from Copilot March 17, 2026 13:48
@baywet baywet enabled auto-merge March 17, 2026 13:48

This comment was marked as outdated.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

This comment was marked as outdated.

Comment thread packages/serialization/form/src/formParseNode.ts

This comment was marked as outdated.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/serialization/form/src/formParseNode.ts
@baywet baywet marked this pull request as ready for review April 15, 2026 16:41
Copy link
Copy Markdown
Contributor

@adrian05-ms adrian05-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see some test updates for formParseNode, shouldn't be the same for jsonParseNode

@baywet
Copy link
Copy Markdown
Member

baywet commented Apr 16, 2026

@adrian05-ms great catch! Added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

reduce parse node allocations when deserializing primitive types

4 participants