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

Avoid boxing in ScopedResource.State internals #3140

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

danicheg
Copy link
Member

@danicheg danicheg commented Feb 13, 2023

This is a dispensable performance tweak. The same workaround is already used in fs2, so it should be fine to reuse it once again. But I could be absolutely wrong on that. Don't hesitate to point me at that.

@diesalbla
Copy link
Contributor

diesalbla commented Feb 13, 2023

@danicheg So, if we are to have classes with null fields, then at least we should contain that nullability. Thus, we should make State into a normal class and add to the companion object two factory methods (or apply), one with and one without the finaliser parameter.

Also, do we have a measure or an intuition as to how many State objects with a different finaliser would be built during the compilation of a Stream, as a function of the number of Pull nodes (of any special type)?

@mpilquist
Copy link
Member

For these types of changes, where the code is arguably harder to read/work with as a result of the optimization, I'd really like to see benchmarks that prove the performance gain pays off.

@danicheg
Copy link
Member Author

danicheg commented Feb 13, 2023

That's absolutely fair to ask for numbers to accept any unsafety. I don't know what the hell got into me to bring this PR without a benchmark 😥

@danicheg danicheg marked this pull request as draft February 13, 2023 18:24
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.

None yet

3 participants