Skip to content
This repository has been archived by the owner on Jul 6, 2020. It is now read-only.

Unnecessary load on Memories.wrap #8

Open
ahmetcanik opened this issue Apr 12, 2020 · 2 comments
Open

Unnecessary load on Memories.wrap #8

ahmetcanik opened this issue Apr 12, 2020 · 2 comments

Comments

@ahmetcanik
Copy link

Validate.notIllegalArgument(buffer.isDirect(), new IllegalArgumentException(String.format("buffer.isDirect(): %b (expected: direct buffer)", buffer.isDirect())));

Second argument is executed independent of the truth value of the first one. Thus even buffer.isDirect is true, IllegalArgumentException constructor and String.format is executed. This yields unnecessary computation on CPU. An example jvisualvm CPU sampling is shown below.

image

@ardikars
Copy link
Member

Thanks @ahmetcanik, I'll review soon.

@ardikars
Copy link
Member

It's already fixed at ardikars/pcap@3b98942, but haven't updated on this project.
I've planed to fix this issue at the end of this month.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants