Skip to content

Improve some sparse arrays #3649

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

Merged
merged 8 commits into from
Mar 20, 2025
Merged

Improve some sparse arrays #3649

merged 8 commits into from
Mar 20, 2025

Conversation

AlexanderKot
Copy link
Contributor

Some sparse arrays exists after my app initialized related to NHib.

image

1

Object type Wasted Wasted After Count Count After
System.Collections.Concurrent.ConcurrentDictionary+VolatileNode<System.Tuple<System.Int32, System.String>, System.String[][]>[] 2,27 MB 0 8047 0

image

Improved by making Loader._subclassEntityAliasesMap lazy initialized
simple entities more frequent in data model then inheritance hierarchy

2

Object type Wasted Wasted After Count Count After
NHibernate.SqlCommand.SqlString+Part[] 736,47 KB 17.48 KB 20339 20343

image

Object type Wasted Wasted After Count Count After
NHibernate.SqlCommand.Parameter[] 410,4 KB 23.58 KB 20329 20331

image

Improved by TrimExcess in internal SqlString(IEnumerable parts) constructor

3

Object type Wasted Wasted After Count Count After
NHibernate.Mapping.ISelectable[] 440,4 KB 9.07 KB 18806 19966

image
image

Improved by SimpleValue.columns 1 default list size (Most simple values mapped to 1 column in DB)

Object type Wasted Wasted After Count Count After
NHibernate.Mapping.Column[] 332,78 KB 1.4 KB 14658 14658

image
image
image

Improved by
Constraint.columns 1 default list size (Most FKs is 1 column)
Index.columns 1 default list size (indexes created for FK usually created by 1 column)
ForeignKey.referencedColumns - make it lazy initialized as not used when referencing PK
ForeignKeyKey - TrimExcess on internal collections

@hazzik hazzik added this to the 5.6 milestone Feb 11, 2025
hazzik
hazzik previously approved these changes Feb 11, 2025
@hazzik hazzik merged commit ba73c43 into nhibernate:master Mar 20, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants