Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Channel reset#756

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jabrena merged 6 commits intoev3dev-lang-java:sysfs_perffromdwalend:channelReset
Dec 13, 2020
Merged

Conversation

@dwalend
Copy link
Contributor

I've created DataChannelRereader - a Closable wrapped around a FileChannel that lets us reread the same fixed-length structure very efficiently.

I've used it (without reusing it) in Sysfs2, to read Strings as a first step. From here I can expand outward into the device and mode APIs to reuse it for specific optimizations, and add to DataChannelRereader to support binary data, as incremental steps.

do {
byteBuffer.clear();
channel.position(0);
n = channel.read(byteBuffer);
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 this could be simplified to achannel.read(byteBuffer, 0) call. However, it's entirely possible that under the hood the two-arg read is just the following, which could be slower:

int old = channel.position();channel.position(0);int rval = channel.read(buffer);channel.position(old);return rval;

@jabrenajabrena merged commit5bc8f1b intoev3dev-lang-java:sysfs_perfDec 13, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@JakubVanekJakubVanekJakubVanek left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@dwalend@JakubVanek@jabrena

[8]ページ先頭

©2009-2025 Movatter.jp