Skip to content

Remove unused sizeInfo and other performance tweaks#1745

Merged
badrishc merged 4 commits into
devfrom
tedhar/dev-perf2
Apr 29, 2026
Merged

Remove unused sizeInfo and other performance tweaks#1745
badrishc merged 4 commits into
devfrom
tedhar/dev-perf2

Conversation

@TedHartMS
Copy link
Copy Markdown
Contributor

Remove unused sizeInfo from InternalRMW, InternalUpsert, UpsertValueSelector, and SessionFunctionsWrapper.
Make some changes to reduce "if"s and field accesses.
This pull request introduces several improvements and refactorings focused on safety, performance, and maintainability in the string operations and storage engine layers. The main themes are: improved type safety and fast paths for string operations, API simplification in session functions, and more accurate heap memory tracking for in-place updates.

String Operations and Type Safety:

  • Improved type safety for RangeIndex operations in RMWMethods.cs: now, type checks are skipped for normal string records (RecordType 0), and only the relevant checks are performed for RangeIndex and non-RangeIndex keys. This prevents unnecessary checks and improves safety for mixed key types. [1] [2]
  • Added a fast path for simple GET on normal inline string keys in ReadMethods.cs, bypassing unnecessary checks for the most common case, which improves read performance.

Session Functions API Simplification:

  • Refactored the ISessionFunctionsWrapper and related wrappers to remove the unused RecordSizeInfo parameter from in-place writer/updater methods, simplifying the API and reducing overhead. [1] [2] [3] [4] [5] [6]

Performance and Memory Tracking:

  • Improved heap memory tracking in InternalRMW.cs by using a logSizeTracker to accurately measure and update heap usage before and after in-place updates, including special handling for expired or deleted objects. [1] [2]

Code Quality and Maintainability:

  • Added [MethodImpl(MethodImplOptions.AggressiveInlining)] to several frequently called methods to encourage inlining and improve performance. [1] [2] [3] [4]
  • Minor documentation and initialization fixes, including clarifying comments and ensuring proper initialization of local variables. [1] [2] [3] [4]

Other:

  • Added clarifying comments to the SETNX/SETXX command encodings in RawStringOperations.cs.
  • Added a note regarding possible expiration on SETEXXX in RMWMethods.cs.

…elector, and SessionFunctionsWrapper. Make some changes to reduce "if"s and field accesses
@TedHartMS TedHartMS requested review from badrishc and Copilot April 28, 2026 06:47
Comment thread libs/server/Resp/RespServerSession.cs Outdated
@badrishc badrishc merged commit f06111c into dev Apr 29, 2026
26 of 29 checks passed
@badrishc badrishc deleted the tedhar/dev-perf2 branch April 29, 2026 22:44
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.

2 participants