-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Change Configuration.Json to use a regular Dictionary. #50611
Conversation
The other Configuration providers use a regular Dictionary. This allows for SortedDictionary to be trimmed in a default Blazor WASM app, saving roughly 4 KB .br compresse.
Tagging subscribers to this area: @maryamariyan, @safern Issue DetailsThe other Configuration providers use a regular Dictionary. This allows for SortedDictionary to be trimmed in a default Blazor WASM app, saving roughly 4 KB .br compressed.
|
Tagging subscribers to 'size-reduction': @eerhardt, @SamMonoRT, @marek-safar, @tannergooding, @CoffeeFlux Issue DetailsThe other Configuration providers use a regular Dictionary. This allows for SortedDictionary to be trimmed in a default Blazor WASM app, saving roughly 4 KB .br compressed.
|
If the order of the data returned to the consumer isn't important, LGTM. But I wonder why this was using a SortedDictionary in the first place. |
I'm wondering if it was trying to preserve ordering from the original file. The way things would be overwritten is preserved? |
I'm really not sure. I looked at the original PR aspnet/Configuration#186, and there were no comments why it was using sorted. There isn't a test for it to be sorted. Also, the other file configuration providers use a regular Dictionary: runtime/src/libraries/Microsoft.Extensions.Configuration.Xml/src/XmlStreamConfigurationProvider.cs Lines 250 to 269 in c24bf80
runtime/src/libraries/Microsoft.Extensions.Configuration.Ini/src/IniStreamConfigurationProvider.cs Lines 26 to 29 in c24bf80
I'm not sure how to find the answer. Is there someone from the ASP.NET team that is an expert on configuration? |
Maybe @HaoK can help here. |
I don't have any context here either as this code was before my time on config as well. The order of the keys for any particular configuration provider shouldn't matter as its just the existence of a key that determines whether its a hit for config lookup purposes. I guess the relevant method that might be affected is GetChildKeys which also seems to do some sorting... runtime/src/libraries/Microsoft.Extensions.Configuration/src/ConfigurationProvider.cs Line 91 in 79ae74f
|
I spoke to the original author and it seems like this may not have been necessary. Carry on. |
I was about to say, lets ask Lou if he remembers :) |
Wait did Lou write this, I asked victor 🤣 |
Nope, you are right, it was Victor, i found the commit: aspnet/Configuration@0517eee |
👋 I have no idea why I wanted the keys to be sorted. I told David that my best guess is that I was trying to preserve the order of elements in arrays but, if that was my intention, the implementation is buggy past 10 elements... So 🤷 sorry... |
/azp run runtime |
Azure Pipelines successfully started running 1 pipeline(s). |
…shim_mono # By Aaron Robinson (10) and others # Via GitHub * upstream/main: (108 commits) [mbr] Add Apple sample (dotnet#50740) make EstablishProxyTunnelAsync throw on failure status code from proxy (dotnet#50763) Improve RGB Min Max evaluation performance by using 2 or 3 comparison… (dotnet#50622) [mono] More domain cleanups (dotnet#50479) Fix Crossgen2 of PlatformDefaultMemberFunction methods and calls. (dotnet#50754) Disable EventSource generator in design-time builds (dotnet#50741) Fix X509 test failures on Android (dotnet#50301) Do not confuse fgDispBasicBlocks in fgMorphBlocks (dotnet#50703) Enforce 64KB event payload size limit on EventPipe (dotnet#50600) Reorganize CoreCLR native build to reduce CMake reconfigures when the build system is untouched (dotnet#49906) [mbr] Turn on hot reload for iOS, tvOS and MacCatalyst (dotnet#50458) improve connection scavenge logic by doing zero-byte read (dotnet#50545) Resolve call mdtokens when making tier 1 inline observations (dotnet#50675) Annotate APIs in System.Private.Xml (dotnet#49682) Support compiling against OpenSSL 3 headers Change Configuration.Json to use a regular Dictionary. (dotnet#50611) Remove unused BigNumFromBinary P/Invoke (dotnet#50670) Make Ninja the default CMake generator on Windows for the repo (dotnet#49715) [AppleAppBuilder] Entitlements to run tests on catalyst using the JIT (dotnet#50637) [mono] Fix delegate invokes to dynamic methods in mixed mode. (dotnet#50547) ... # Conflicts: # src/mono/dlls/mscordbi/CMakeLists.txt
The other Configuration providers use a regular Dictionary.
This allows for SortedDictionary to be trimmed in a default Blazor WASM app, saving roughly 4 KB .br compressed.