Skip to content

Commit

Permalink
Showing 1 changed file with 0 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -68,7 +68,6 @@ public final byte[] getRawBytes() {

public final byte[] getBytes() {
if (bytes == null) {
CompilerDirectives.transferToInterpreter();
bytes = RopeOperations.flattenBytes(this);
}

5 comments on commit 0caf4db

@chrisseaton
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be profiled though?

@eregon
Copy link
Member

@eregon eregon commented on 0caf4db Feb 2, 2016

Choose a reason for hiding this comment

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

Maybe automatic branch probability is enough here?
If not just specifying the probability might be better and more practical, in practice it's very likely to happen that the field is not set, right?

@chrisseaton
Copy link
Contributor

Choose a reason for hiding this comment

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

You mean branch probability in the CPU? I was more interested in removing the code in the PE.

@eregon
Copy link
Member

@eregon eregon commented on 0caf4db Feb 2, 2016

Choose a reason for hiding this comment

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

Yes. It's just an Invoke, and it would only fold interestingly if the Rope is constant, right?

@nirvdrum
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For LeafRope, which all String literals are, the field will be non-null. For ConcatRope and SubstringRope, it'll be null on first access. I was trying to not penalize the cases where we have the bytes already.

Please sign in to comment.