Use memory more efficiently when reading files, serialising and deserialising - #9
Merged
Conversation
(cherry picked from commit 83c1d29b61fa624c48f47eded05b0f87efb46cd5)
(cherry picked from commit bf8e1668f312bd8296aeb8fcfc2b1ba20ded2f53)
(cherry picked from commit a4cabc71090b52cf2380213c13b0d8318f4ba751)
(cherry picked from commit 4a7f2414d58364195e385d4ad68dd7940c69c033)
(cherry picked from commit e67b6e09160542c7b6721bd483253daae80099dc)
(cherry picked from commit c5e60b959c719b483c428deee1cf00d2dd5c2a8d)
kristiker
reviewed
Sep 8, 2026
Comment on lines
+23
to
+24
| /// <summary>The value has not been read from the stream yet; <see cref="InlineValue.Ticks"/> holds the position it starts at.</summary> | ||
| Deferred, |
Member
There was a problem hiding this comment.
What does ticks means, i'd expect 'offset'. @copilot what you think
There was a problem hiding this comment.
Good call, added Offset as an alias field (same union slot) on InlineValue and switched the Deferred slot usage to it in 5dc983d, keeping Ticks only for the Time case.
Member
There was a problem hiding this comment.
Co-authored-by: kristiker <26466974+kristiker@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes attributes a 40 byte slot with an inline value union, one array per element, instead of an
OrderedDictionaryof attribute objects with boxed valuesArrays are now slices of 1 MB chunks on the large object heap, read with one copy, instead of a List filled one boxed item at a time
Elements live in a generic dictionary and list under one lock, sized from the file, with IDs generated on first use
Typed loading assigns class properties through typed bindings, without boxing
Saving gathers strings and element order in one pass, writes from the slots without boxing, writes value arrays in one piece and buffers the output
Adds a general AttributeType enum, named after valve's DmAttributeType_t