Skip to content

Conversation

@not-matthias
Copy link
Member

@not-matthias not-matthias commented Dec 15, 2025

Changes in this PR:

  • Now using the same logic as Walltime, to only compress when the size exceeds the threshold
  • Encode the events manually one-by-one to allow streamed decoding
  • Removed the Mutex<Vec<Event>> which added additional locking overhead during each iteration

@not-matthias not-matthias force-pushed the cod-1803-support-allocation-heavy-benchmarks branch 2 times, most recently from af1f5e9 to 936bb32 Compare December 17, 2025 16:00
Copy link

Copilot AI left a comment

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 adds support for allocation-heavy benchmarks by optimizing memory usage during event collection and serialization. The changes enable handling large volumes of memory allocation events without causing excessive memory consumption.

Key Changes:

  • Modified the Memory executor to use size-based compression logic (matching WallTime behavior) instead of always using in-memory compressed archives
  • Introduced streaming serialization for MemtrackArtifact to avoid loading all events into memory at once
  • Simplified event handling by removing unnecessary Arc/Mutex wrappers and directly returning events from the processing thread

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
src/run/uploader/upload.rs Moved Memory executor from Valgrind's always-compress logic to WallTime's size-based compression decision
crates/runner-shared/src/artifacts/mod.rs Added encode_to_writer trait method with default implementation for streaming serialization
crates/runner-shared/src/artifacts/memtrack.rs Implemented custom encode_to_writer and decode_streamed for streaming event serialization/deserialization
crates/memtrack/src/main.rs Refactored event collection to return Vec directly from thread instead of using Arc<Mutex>
Comments suppressed due to low confidence (1)

crates/runner-shared/src/artifacts/memtrack.rs:33

  • The encode_to_writer method override for MemtrackArtifact is not explicitly tested for error conditions. While the happy path is tested in test_decode_streamed, consider adding test coverage for scenarios where serialization might fail, such as write errors or invalid event data, to ensure proper error propagation.
impl MemtrackArtifact {
    pub fn decode_streamed<R: std::io::Read>(reader: R) -> anyhow::Result<MemtrackEventStream<R>> {
        Ok(MemtrackEventStream {
            deserializer: rmp_serde::Deserializer::new(reader),
        })
    }
}

#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
pub struct MemtrackEvent {
    pub pid: pid_t,
    pub tid: pid_t,
    pub timestamp: u64,
    pub addr: u64,

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

@not-matthias not-matthias force-pushed the cod-1803-support-allocation-heavy-benchmarks branch from 936bb32 to 12452f0 Compare December 18, 2025 09:41
@not-matthias not-matthias merged commit 12452f0 into main Dec 18, 2025
12 checks passed
@not-matthias not-matthias deleted the cod-1803-support-allocation-heavy-benchmarks branch December 18, 2025 09:49
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