Open tmat opened 1 year ago
Thanks for contacting us.
We're moving this issue to the .NET 9 Planning
milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.
Would a community contribution of this be accepted?
Noticed this too - in the dotnet new webapiaot
template app, there's 40+ kB of string literals related to the error page. This affects both startup time and use of private bytes (the literals need to be allocated somewhere and they get never freed). This would be a 20+ kB saving just for the error page.
Note I started investigating a fix to support this a while back in https://github.com/dotnet/razor/tree/damianedwards/Utf8HtmlLiterals Can't quite remember where I got to, but I think it involved a new directive to enable changing the format the HTML literals are encoded in and plumbing that all the way through to the compiler.
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
The source generator currently uses regular string literals for HTML content.
For example,
String literals are stored in the assembly in
#US
metadata heap using UTF16 encoding. The heap size is limited and larger apps run out of the space. See https://github.com/dotnet/aspnetcore/issues/20224.Describe the solution you'd like
Using UTF8 literals would address this issue. UTF8 literals are stored directly in the PE image at specified RVA. The metadata heap size limitations thus do not apply.
Besides, it would likely be faster and more memory efficient to render the pages since UTF16 to UTF8 encoding might be avoided.
Additional context
No response