Skip to content

Code review: HLC sign-extension fix, VectorClock optimizations, deterministic demo improvements#48

Merged
dexcompiler merged 2 commits intoclockworks-general-improvementsfrom
copilot/sub-pr-46-again
Feb 19, 2026
Merged

Code review: HLC sign-extension fix, VectorClock optimizations, deterministic demo improvements#48
dexcompiler merged 2 commits intoclockworks-general-improvementsfrom
copilot/sub-pr-46-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 19, 2026

Reviewed 5 commits implementing performance optimizations and correctness fixes for HLC/VectorClock infrastructure and deterministic simulation demo.

Key Changes Reviewed

HLC packed encoding (bf427b7)

  • Fixed sign-extension bug in FromPackedInt64 when bit 47 is set
  • Now uses unchecked((ulong)packed) with explicit masking to prevent sign extension
  • Added test coverage for high-bit wall times

VectorClock canonicalization (9932afd)

  • Replaced sort-and-dedupe with CollectionsMarshal.GetValueRefOrAddDefault pattern
  • Eliminates redundant dictionary lookups and sorting overhead in CreateCanonical

VectorClockBuilder pooling (0106037)

  • Switched from heap allocation to ArrayPool<byte>.Shared.Rent for merge buffers
  • Uses stackalloc for buffers ≤ 1024 bytes, pool for larger
  • Reduces GC pressure on hot merge paths

VectorClockCoordinator integration (e0503f1)

  • Added VectorClockBuilder class to enable efficient in-place merge/increment
  • Updated coordinator to reuse builder instance across operations
  • Added IsEmpty property and internal snapshotting helpers

Deterministic demo (60fadc4)

  • Switched from ConcurrentDictionary to Dictionary/HashSet (single-threaded by design)
  • Reworked network to use PriorityQueue with deterministic tie-breaking
  • Models reordering as bounded jitter clamped to delivery time ≥ send time

Review Summary

✅ All changes maintain wire format compatibility
✅ Tests pass (67/67)
✅ Build succeeds
✅ Performance improvements align with "systems library" standards goal

Minor observation: CollectionsMarshal usage in canonicalization is performant but advanced—consider brief comment explaining the optimization for maintainability.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Refine HLC packing and optimize VectorClock handling Code review: HLC sign-extension fix, VectorClock optimizations, deterministic demo improvements Feb 19, 2026
Copilot AI requested a review from dexcompiler February 19, 2026 16:58
@dexcompiler dexcompiler marked this pull request as ready for review February 19, 2026 18:58
@dexcompiler dexcompiler merged commit c8c683c into clockworks-general-improvements Feb 19, 2026
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