Skip to content

Conversation

@lightsing
Copy link
Member

dogeos using codec crate in guest, zstd won't compile on such target.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 9, 2025

CodSpeed Performance Report

Merging #457 will not alter performance

Comparing fix/codec-guest-compat (c955480) with main (8c1f7d1)

Summary

✅ 2 untouched


use zstd::Decoder;
#[cfg(feature = "zstd")]
use ruzstd as _;
Copy link
Contributor

Choose a reason for hiding this comment

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

ruzstd is only used for decoding? I guess it should be fully compatible with the C impl, right?

Copy link
Member

@georgehao georgehao Dec 9, 2025

Choose a reason for hiding this comment

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

also curious about this?

dogeos using codec crate in guest, zstd won't compile on such target.

don't get this, why don't put decompress_blob_data at dogeos side

Copy link
Member Author

Choose a reason for hiding this comment

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

they also uses other things provided by scroll-codec, so two options:

  1. provide option to use rust zstd
  2. gate v2::zstd, and make zstd as optional dep.

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. gate v2::zstd, and make zstd as optional dep.

Does that mean that they don't actually need decompress_blob_data? Otherwise, without zstd, how would it work?

@Thegaram Thegaram requested a review from georgehao December 9, 2025 07:40
let mut decoder = StreamingDecoder::new(header_data.as_slice()).unwrap();
// heuristic: use data length as the allocated output capacity.
let mut output = Vec::with_capacity(header_data.len());
decoder.read_to_end(&mut output).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see why it's safe to use unwrap here. Are you sure this cannot fail? If not, we should return Result instead

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, but previous zstd call also unwrap and ignore errors, is there a such assumption that data is always valid?

let mut decoder = Decoder::new(header_data.as_slice()).unwrap();

while let Ok(size) = decoder.read(&mut dst) {

Copy link
Member Author

Choose a reason for hiding this comment

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

returning Result will change the API, it's a breaking change, ok for me, but ok for others?

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this function is only used inside rollup-node, no?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's fine to update the API.

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.

5 participants