Skip to content

Conversation

@SyMind
Copy link
Collaborator

@SyMind SyMind commented Sep 25, 2025

This PR optimizes the RawBufferSource struct to avoid unnecessary string allocations by using self-referential structs and Cow<'this, str> instead of String. The change leverages the ouroboros crate to create self-referential structures that can borrow from their own data.

Copilot AI review requested due to automatic review settings September 25, 2025 02:59
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 optimizes the RawBufferSource struct to avoid unnecessary string allocations by using self-referential structs and Cow<'this, str> instead of String. The change leverages the ouroboros crate to create self-referential structures that can borrow from their own data.

  • Replaced OnceLock<String> with OnceLock<Cow<'this, str>> to avoid string copying
  • Converted RawBufferSource to a self-referential struct using the ouroboros crate
  • Added custom implementations for Clone, PartialEq, and Eq traits

Reviewed Changes

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

File Description
src/raw_source.rs Converted RawBufferSource to self-referential struct and optimized string handling
Cargo.toml Added ouroboros = "0.18.5" dependency for self-referential struct support

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Sep 25, 2025

CodSpeed Performance Report

Merging #167 will not alter performance

Comparing SyMind:refactor-raw-buffer-source (608e809) with main (79e2dfc)

Summary

✅ 7 untouched

@SyMind SyMind force-pushed the refactor-raw-buffer-source branch from ba5985b to 07987ed Compare September 25, 2025 03:26
@SyMind SyMind merged commit 1d5383a into rstackjs:main Sep 25, 2025
7 checks passed
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.

1 participant