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

[Truffle] Experiment with lazy integer ropes. #3805

Closed
wants to merge 1 commit into from

Conversation

chrisseaton
Copy link
Contributor

@nirvdrum what do you think of this?

Saves about 5s on test fast for me, and it makes patterns like this constant fold to nothing:

loop do
  start = Time.now
  10_000_000.times do
    "foo " + 14.to_s
  end
  puts Time.now - start
end

@chrisseaton chrisseaton added this to the truffle-dev milestone Apr 14, 2016
}

@Override
public byte[] fulfil() {
Copy link
Contributor

Choose a reason for hiding this comment

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

fulfil -> fulfill? I think we were standardizing on US spelling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@nirvdrum
Copy link
Contributor

The rope portion looks good to me. Do you have a sense of how often the lazy part pays off? The other container ropes generally see an advantage with GetByteNode, which is used for String#[] with a single index in 7-bit strings. So, they see a lot of utility without having to populate their byte array. But this looks like it faults on that operation.

@nirvdrum
Copy link
Contributor

Also, you may want to add something to RopeNodes.DebugPrintRopeNode. That's called by Truffle::Primitive.debug_print_rope, which can be handy when you want to see the structure of a rope without a debugger.

}

@TruffleBoundary
@Specialization
public DynamicObject inspect(long n) {
if (n >= Integer.MIN_VALUE && n <= Integer.MAX_VALUE) {
Copy link
Member

Choose a reason for hiding this comment

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

CoreLibrary.fitsIntoInteger

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@chrisseaton chrisseaton deleted the truffle-lazy-int-ropes branch April 17, 2016 17:52
@enebo enebo added this to the Non-Release milestone Dec 7, 2017
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

4 participants