-
Notifications
You must be signed in to change notification settings - Fork 345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add .NET 6 target that uses System.Text.Json and IL trimming #3605
Conversation
src/client/Microsoft.Identity.Client/Microsoft.Identity.Client.csproj
Outdated
Show resolved
Hide resolved
LGTM so far |
We should run some tests on net6 and some tests on netcoreapp2.1 ... |
…re possible or STJ.
...crosoft.Identity.Test.Integration.netcore/Microsoft.Identity.Test.Integration.NetCore.csproj
Show resolved
Hide resolved
tests/Microsoft.Identity.Test.Integration.netfx/HeadlessTests/RuntimeBrokerTests.cs
Show resolved
Hide resolved
tests/Microsoft.Identity.Test.Integration.netfx/HeadlessTests/RuntimeBrokerTests.cs
Show resolved
Hide resolved
tests/Microsoft.Identity.Test.Performance/Microsoft.Identity.Test.Performance.csproj
Show resolved
Hide resolved
src/client/Microsoft.Identity.Client/Cache/Items/CacheSerializationContract.cs
Show resolved
Hide resolved
@pmaytak - is there a noticeable different in latency / memory usage for getting a token out of the cache / getting a token from AAD ? So that we can craft an argument as "Improve perf by X% and memory usage by Y% in common scenarios" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please merge main and make sure that iOS Builds before you merge into main branch.
src/client/Microsoft.Identity.Client/Cache/Items/CacheSerializationContract.cs
Show resolved
Hide resolved
…/microsoft-authentication-library-for-dotnet into pmaytak/system-text-json
… to platform folder to conditionally compile.
6eefb68
to
7b921d1
Compare
@bgavrilMS Added the perf results to the top post. The NET6 STJ is definitely faster but the spread seems to be anywhere 5-50%. 10% is probably the safe number? |
@pmaytak - just an idea, but if we were to run the perf tests on the MSAL net2.1 TFM but use net6 at runtime (e.g. by commenting out MSAL net6 TFM and running the perf tests under net6), we could actually extract / isolate the perf impact of the JSON improvement. |
Suggestion for getting the MacOs project to run - you can conditionally compile only the Xamarin targets and skip the net6 targets on that stage of the build. |
Follow up - how common is to have 1 partition / 10-1000 tokens per partition? I would think that many partitions with 1 token is more common? |
Hmm, yea, interesting. I can try this. This does eliminate the runtime difference, but wouldn't there still be variability with the compiled binaries themselves? To rephrase - would the same code compiled into net6 / netcore3.1 targets be different?
Yea, I think many tenants with few tokens is more common. Although I remember a case or two where the Redis cache entry was large because of app token partition. I think we should add this to new telemetry. I think we already log this count anyway. |
Didn't work. The issue is with restore task. It ends up using mono, which doesn't see .NET 6. |
The columns are:
Seems like there's an improvement running on .NET 6 and further improvements using STJ.
|
Fixes #1550, fixes #3407
Changes proposed in this request
Example of an app that calls
AcquireTokenInteractive
and was built as self-contained:Testing
Performance impact
The rows represent different tests benchmarked. The columns represent the comparison -
The before and after code that uses Newtonsoft should be the same, included here to check for regressions.
Test results for current PR:
(previous Net3.1)
(new Net3.1)
(new Net6)
(previous Net3.1)
(new Net3.1)
(new Net6)
Test results for original PR:
(old Net3.1)
(new Net6)
(old Net3.1)
(new Net6)
Documentation
N/A
Code tour
systemtextjson-in-net-6.zip