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

re-implement (native) IOBuffer for JRuby #1691

Merged
merged 1 commit into from
Feb 20, 2019
Merged

Conversation

kares
Copy link
Contributor

@kares kares commented Dec 20, 2018

... to match up JRuby's ext with the C ext

extensions now provide the same functionality - no need for branching (around Puma::IOBuffer)

this has been motivated by warnings on Java 9+ due field_reader :buf having protected access
since JRuby does not generate native classes for Java sub-classes (atm): jruby/jruby#5532

... to match up JRuby's ext with the C ext
@evanphx
Copy link
Member

evanphx commented Dec 20, 2018

@headius Would you mind giving this a review?

@olleolleolle
Copy link
Contributor

olleolleolle commented Jan 20, 2019

@enebo Would you be able to give this a review? 🔍 👁‍🗨 🔎

@headius
Copy link
Contributor

headius commented Jan 21, 2019 via email

Copy link
Contributor

@enebo enebo left a comment

Choose a reason for hiding this comment

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

I leave the backing array question as just something I pondered. I don't know how much these are reused and whether the extra potential alloc'ed backing array matters. Does not seem like it should hold this back as it can be changed later if it is a problem.


@JRubyMethod
public IRubyObject reset() {
buffer.setRealSize(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure this is actionable but this won't reduce/remove backing array of bytelist. I would not worry about it but if someone loads a massive IOBuffer and it is reused it will just drag around a massive backing array as long as it lives.

Copy link
Contributor Author

@kares kares Jan 21, 2019

Choose a reason for hiding this comment

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

which is exactly the same behaviour as puma has using ByteArrayOutputStream#reset ... thus such a debate would be for later (ideally reported in an issue if you feel its really a problem).

Copy link
Contributor

Choose a reason for hiding this comment

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

@kares yeah I agree and did notice it was like this before as well.

@enebo
Copy link
Contributor

enebo commented Jan 21, 2019

@kares I did approve the review but I can explicitly state it here as well. This looks good to be merged.

@kares
Copy link
Contributor Author

kares commented Jan 22, 2019

sorry about that I removed the comment - was half asleep and did not notice the approval first.
probably as they changed the UI style and there wasn't a green mark next to your comment.
and thank you for the review.

@enebo
Copy link
Contributor

enebo commented Jan 22, 2019

@kares no worries. I agree my comment would be confusing to read even with the approval. I should have probably mentioned it after the merge.

@olleolleolle
Copy link
Contributor

@evanphx @schneems The tests pass (apart from a "rubygems-update requires Ruby version >= 2.3.0." on Ruby 2.2) and code has been reviewed.

Is this ready, now?

@evanphx evanphx merged commit 0d52a4b into puma:master Feb 20, 2019
@enebo
Copy link
Contributor

enebo commented Feb 20, 2019

@kares @olleolleolle I know this was motivated by Java 9+ warnings but do you anticipate any perf gains now that this landed?

@kares
Copy link
Contributor Author

kares commented Feb 20, 2019

not really, except for some byte copy-ing ... maybe slightly less mem use (not sure what the buff is used for)

@adurgin
Copy link

adurgin commented Mar 15, 2019

@evanphx @kares @enebo Hi. Would it be possible to release a gem with this fix included?

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

6 participants