-
Notifications
You must be signed in to change notification settings - Fork 934
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 cached boxed boolean values to BooleanType #3230
Conversation
a4b00bc
to
7c9539f
Compare
7c9539f
to
288d978
Compare
Do I need to do with the failed "Generate Async code" check? |
You need to enable Allow edits and access to secrets by maintainers in your PR |
Thanks for pointing me to the right direction, @bahusoid . |
I have generated async files locally. |
Thanks, @fredericDelaporte, I have seen how it should look like in the documentation. |
25fb45c
to
3ff4371
Compare
it is faster and avoids memory allocations
3ff4371
to
166ec54
Compare
Problem
In one of our app we use a long lived NHibernate session. I know that is not by the design of NHibernate, but anyway.
Just when the app is started, it creates a lot of objects in Heap, one of the biggest (by number of object) allocations is "boxed booleans", created by
BooleanType.Get
(around ~300k of objects, ~6.87MB).The only related discussion I have found is #2187
PR description
BooleanType
contains pre-boxedtrue
/false
values, and returns them instead of boxing of booleans each time.It is:
Benchmarks
BenchmarkDotNet=v0.13.4, OS=Windows 11 (10.0.22621.1105)
AMD Ryzen 7 5700U with Radeon Graphics, 1 CPU, 16 logical and 8 physical cores
[Host] : .NET Framework 4.8.1 (4.8.9105.0), X64 RyuJIT VectorSize=256
.NET 6.0 : .NET 6.0.13 (6.0.1322.58009), X64 RyuJIT AVX2
.NET 7.0 : .NET 7.0.2 (7.0.222.60605), X64 RyuJIT AVX2
.NET Framework 4.8 : .NET Framework 4.8.1 (4.8.9105.0), X64 RyuJIT VectorSize=256
Benchmark code
Program.cs
csproj