Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use RecyclableMemoryStream #16949

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Use RecyclableMemoryStream #16949

wants to merge 10 commits into from

Conversation

MikeAlhayek
Copy link
Member

Fix #16946

@sebastienros I am carious to see is RecyclableMemoryStream will have an impact on the project. If you have time to do a comparison that would be awesome.

Fix #16946

Related Work Items: #169
@hishamco
Copy link
Member

hishamco commented Nov 4, 2024

I was waiting for Seb reply on the issue to let the author propose the PR, but seems you do it quickly :)

Copy link
Member

@sebastienros sebastienros left a comment

Choose a reason for hiding this comment

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

I am very familiar with this API and I don't think we have many actual usages of it. At least not by replacing where we already use MemoryStream, I can explain at Tuesday's meeting.

Copy link
Member

@sebastienros sebastienros left a comment

Choose a reason for hiding this comment

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

Some comments but LGTM

@@ -11,7 +12,7 @@ public async Task<string> GetTextAsync(string path, Stream fileStream)
// https://github.com/UglyToad/PdfPig/blob/master/src/UglyToad.PdfPig.Core/StreamInputBytes.cs#L45.
// Thus if it isn't, which is the case with e.g. Azure Blob Storage, we need to copy it to a new, seekable
// Stream.
MemoryStream seekableStream = null;
RecyclableMemoryStream seekableStream = null;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should think about copying the stream on the file system instead of memory. #16955

@@ -0,0 +1,11 @@
using Microsoft.IO;
Copy link
Member

Choose a reason for hiding this comment

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

Do we have an actual infrastructure package that is no "abstractions" or a common project where we put helpers?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is Infrastructure project. but not all of these projects depend on Infrastructure they depend on Infrastructure.Abstractions` I am also not happy to add this to the abstraction project. I am open to better placement.

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.

Use Microsoft.IO.RecyclableMemoryStream
3 participants