Skip to content

fix: performance issue with enum parsing during deserialization#670

Merged
baywet merged 9 commits intomainfrom
perf/enum-deserialization
Mar 19, 2026
Merged

fix: performance issue with enum parsing during deserialization#670
baywet merged 9 commits intomainfrom
perf/enum-deserialization

Conversation

@baywet
Copy link
Member

@baywet baywet commented Mar 10, 2026

partial #632

Signed-off-by: Vincent Biret <vibiret@microsoft.com>
@baywet baywet force-pushed the perf/enum-deserialization branch from cc5d273 to 4ff0582 Compare March 11, 2026 15:39
@baywet baywet marked this pull request as ready for review March 11, 2026 20:39
@baywet baywet requested a review from a team as a code owner March 11, 2026 20:39
@baywet baywet enabled auto-merge (squash) March 11, 2026 20:39
@baywet baywet disabled auto-merge March 11, 2026 20:41
@baywet baywet marked this pull request as draft March 11, 2026 21:37
adrian05-ms
adrian05-ms previously approved these changes Mar 11, 2026
@github-project-automation github-project-automation bot moved this to In Progress 🚧 in Kiota Mar 11, 2026
baywet added 2 commits March 13, 2026 12:14
* fix: avoid multiple strings allocations when deserializing flag enums

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* fix: avoid assigning parse nodes for collections of primitive values in json

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* fix: avoid allocation of parse nodes in form deserialization of collections

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* fix: further reduction of node assignments in cases where it's not necessary

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

* fix: cleaner branching in loops to reduce padding

Signed-off-by: Vincent Biret <vibiret@microsoft.com>

---------

Signed-off-by: Vincent Biret <vibiret@microsoft.com>
@baywet
Copy link
Member Author

baywet commented Mar 13, 2026

@copilot the code coverage is low for the following methods, add some unit tests

FormParseNode -> GetCollectionOfPrimitiveValues
FormParseNode -> GetScalarValue (DateTimeOffset, Double, Date, Decimal, Guid, Float, Int, Long)

JsonParseNode -> GetScalarValue (Bool, Byte, SByte, ByteArray)
JsonParseNode -> GetCollectionOfEnumValues
JsonParseNode -> GetCollectionOfPrimitiveValues (missing types)

Copy link
Contributor

Copilot AI commented Mar 13, 2026

@baywet I've opened a new pull request, #684, to work on those changes. Once the pull request is ready, I'll request review from you.

…lection methods (#684)

* Initial plan

* test: add missing unit tests for FormParseNode and JsonParseNode methods

- Add long? support to FormParseNode.GetCollectionOfPrimitiveValues
- Add private GetLongValue(string) helper to FormParseNode
- Add GetCollectionOfLongPrimitiveValuesFromForm test
- Add GetCollectionOfDateTimeOffsetPrimitiveValuesFromForm test
- Add GetCollectionOfDatePrimitiveValuesFromForm test
- Add JsonParseNode scalar tests: GetBoolValue, GetByteValue, GetSbyteValue, GetByteArrayValue
- Add JsonParseNode GetCollectionOfEnumValues tests
- Add JsonParseNode GetCollectionOfPrimitiveValues tests for bool?, byte?, sbyte?"

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

* test: rename GetByteArrayValue test method to better reflect its intent

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

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: baywet <7905502+baywet@users.noreply.github.com>
baywet added 2 commits March 13, 2026 13:18
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
Signed-off-by: Vincent Biret <vibiret@microsoft.com>
@baywet baywet marked this pull request as ready for review March 13, 2026 17:43
@baywet baywet enabled auto-merge (squash) March 13, 2026 17:44
@baywet baywet merged commit 3a09234 into main Mar 19, 2026
9 of 11 checks passed
@baywet baywet deleted the perf/enum-deserialization branch March 19, 2026 15:30
@github-project-automation github-project-automation bot moved this from In Progress 🚧 to Done ✔️ in Kiota Mar 19, 2026
@sonarqubecloud
Copy link

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

Labels

None yet

Projects

Status: Done ✔️

Development

Successfully merging this pull request may close these issues.

3 participants