Skip to content

Improve RecordSizeInfo performance; remove obsolete files#1769

Merged
TedHartMS merged 6 commits into
devfrom
tedhar/dev-perf3
May 7, 2026
Merged

Improve RecordSizeInfo performance; remove obsolete files#1769
TedHartMS merged 6 commits into
devfrom
tedhar/dev-perf3

Conversation

@TedHartMS

@TedHartMS TedHartMS commented May 5, 2026

Copy link
Copy Markdown
Contributor

Optimize RecordSizeInfo struct layout by packing boolean flags (KeyIsInline,
ValueIsInline, IsRevivifiedRecord) and small integer fields (KeyLengthBytes,
RecordLengthBytes) into a single int word using bit manipulation. This reduces
struct size and enables cheaper composite checks like RecordIsInline via a
single bitwise AND.

Remove obsolete VarbyteLengthUtility.cs (superseded a while ago by RecordDataHeader) and PinnedSpanByteComparer

TedHartMS and others added 2 commits May 4, 2026 17:30
Optimize RecordSizeInfo struct layout by packing boolean flags (KeyIsInline,
ValueIsInline, IsRevivifiedRecord) and small integer fields (KeyLengthBytes,
RecordLengthBytes) into a single int word using bit manipulation. This reduces
struct size and enables cheaper composite checks like RecordIsInline via a
single bitwise AND.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes Tsavorite record sizing metadata by packing RecordSizeInfo flags/byte-count fields into a single word for smaller struct size and cheaper checks, and removes the long-obsolete VarbyteLengthUtility in favor of RecordDataHeader.

Changes:

  • Packed RecordSizeInfo fields into an int word and updated allocators/tests to use Set*Inline() / SetIsRevivifiedRecord().
  • Removed VarbyteLengthUtility.cs and updated references/comments to RecordDataHeader.
  • Added an AOF recovery test that exercises Upsert behavior with expirations.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
test/Garnet.test/RespAofTests.cs Adds AOF recovery test for Upsert with expirations/TTL checks.
libs/storage/Tsavorite/cs/test/RevivificationTests.cs Updates tests to use RecordDataHeader constants and new RecordSizeInfo setters.
libs/storage/Tsavorite/cs/test/ObjectInlineTests.cs Fixes assertion parameter order.
libs/storage/Tsavorite/cs/test/LogRecordTests.cs Updates constants and adapts tests to packed RecordSizeInfo layout.
libs/storage/Tsavorite/cs/src/core/VarLen/RecordSizeInfo.cs Introduces packed word bitfield and rewrites related properties.
libs/storage/Tsavorite/cs/src/core/Allocator/SpanByteAllocatorImpl.cs Uses SetKeyIsInline/SetValueIsInline with packed RecordSizeInfo.
libs/storage/Tsavorite/cs/src/core/Allocator/ObjectAllocatorImpl.cs Uses SetKeyIsInline/SetValueIsInline with packed RecordSizeInfo.
libs/storage/Tsavorite/cs/src/core/Allocator/ObjectSerialization/RecordDataHeader.cs Switches revivification flagging to packed RecordSizeInfo.
libs/storage/Tsavorite/cs/src/core/Allocator/LogRecord.cs Adjusts IPU sizing logic due to packed RecordSizeInfo/optionals calculation.
libs/storage/Tsavorite/cs/src/core/Allocator/LogField.cs Updates docs to reference RecordDataHeader.
libs/storage/Tsavorite/cs/src/core/Allocator/ObjectSerialization/VarbyteLengthUtility.cs Deletes obsolete utility implementation.
libs/storage/Tsavorite/cs/benchmark/YCSB.benchmark/KeySpanByte.cs Updates benchmark comment references to RecordDataHeader.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread libs/storage/Tsavorite/cs/src/core/VarLen/RecordSizeInfo.cs
Comment thread libs/storage/Tsavorite/cs/src/core/VarLen/RecordSizeInfo.cs
Comment thread libs/storage/Tsavorite/cs/src/core/VarLen/RecordSizeInfo.cs Outdated
Comment thread libs/storage/Tsavorite/cs/src/core/VarLen/RecordSizeInfo.cs Outdated
Comment thread libs/storage/Tsavorite/cs/src/core/Allocator/ObjectAllocatorImpl.cs
Comment thread libs/storage/Tsavorite/cs/src/core/Allocator/LogRecord.cs
Comment thread test/Garnet.test/RespAofTests.cs Outdated
Comment thread test/Garnet.test/RespAofTests.cs Outdated
Comment thread test/Garnet.test/RespAofTests.cs
@TedHartMS TedHartMS changed the title Improve RecordInfo performance; remove obsolete VarbyteLengthUtility Improve RecordSizeInfo performance; remove obsolete VarbyteLengthUtility May 6, 2026
@TedHartMS TedHartMS changed the title Improve RecordSizeInfo performance; remove obsolete VarbyteLengthUtility Improve RecordSizeInfo performance; remove obsolete files May 7, 2026
@TedHartMS TedHartMS merged commit 33e0303 into dev May 7, 2026
29 of 30 checks passed
@TedHartMS TedHartMS deleted the tedhar/dev-perf3 branch May 7, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants