Skip to content

Consider setting InvariantGlobalization in api template #47029

Closed
@eerhardt

Description

@eerhardt

API server applications often don't need to consider culture behavior. The data flowing in and out of the application is created and consumed by other applications (not humans). This data is typically in a culture independent format because it is consumed by other applications.

We should consider adding <InvariantGlobalization>true</InvariantGlobalization> to the dotnet new api template. This can easily be removed by the app developer, if their API app needs culture aware behavior. Alternatively, if we really thought the decision should be directly made by the user, we can make it an optional checkbox in the template dialog in VS.

Enabling InvariantGlobalization brings with it some nice performance benefits.

On Windows x64, the BasicMinimalApi using EnableRequestDelegateGenerator=true, the app size goes from:

main: 9.70 MB (10,179,072 bytes)
InvariantGlobalization: 9.48 MB (9,945,600 bytes)

It also appears to help with startup times (linux-x64):

main: Start Time (ms) | 40
InvariantGlobalization: Start Time (ms) | 37

And memory consumption (linux-x64):

main: Working Set (MB) | 47
InvariantGlobalization: Working Set (MB) | 43

cc @DamianEdwards @davidfowl @mangod9 @tarekgh

Metadata

Metadata

Assignees

Labels

old-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions