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 encoding #2765

Merged
merged 23 commits into from Mar 27, 2015
Merged

Truffle encoding #2765

merged 23 commits into from Mar 27, 2015

Conversation

nirvdrum
Copy link
Contributor

This is a bit large and I had to do some interesting things to init Rubinius properly. I'd appreciate another set of eyes before I merge it. @chrisseaton @eregon

…ell.

While we're using Rubinius's encoding subsystem substantially, we still delegate to JRuby methods in various places.  JRuby's runtime is unaware of any encoding values set via Rubinius and as a result, we can generate strings with incorrect encodings if we don't take care to update JRuby's runtime as well.
…code! from Rubinius.

This commit also fixes several issues in our encoding implementation that surfaced through greater usage of Encoding and Encoding::Converter.
null,
getContext().makeString("filesystem"),
indexLookup(encodings, filesystemEncoding)
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you create some kind of createTuple helper here?

self.default_internal_jruby = enc
end
end
end
Copy link
Member

Choose a reason for hiding this comment

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

I like this

@eregon
Copy link
Member

eregon commented Mar 27, 2015

truffle/src/main/ruby/core/rubinius/delta/converter_paths.rb does not look pretty with its 7000+ assignments to a Hash. Do we have this map already somewhere in JRuby?
Also most of them are "go through UTF-8", not really sure of the gain to save that path in memory.

@paths = {}
@load_cache = true
@cache_valid = false
@transcoders_count = TranscodingMap.size
Copy link
Member

Choose a reason for hiding this comment

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

Ah here, I see. Could be worth to make a private class method setup that initialize to non-trivial values. But probably good enough for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was trying to avoid modifying their source altogether since it would make future updates easier. But I'm open to other options.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, this is good for now I think.

nirvdrum added a commit that referenced this pull request Mar 27, 2015
@nirvdrum nirvdrum merged commit da248f2 into master Mar 27, 2015
@nirvdrum nirvdrum deleted the truffle_encoding branch March 27, 2015 14:10
@eregon
Copy link
Member

eregon commented Mar 27, 2015

Startup suffers quite a bit though ...

$ for i in {1..10}; do; jt run -e 'puts :hi'; done
Before:
  4.46s user 0.14s system 160% cpu 2.872 total
  4.40s user 0.14s system 159% cpu 2.845 total
  4.45s user 0.13s system 159% cpu 2.875 total
After:
  10.18s user 0.22s system 169% cpu 6.145 total
  10.18s user 0.22s system 164% cpu 6.308 total
  9.91s user 0.24s system 164% cpu 6.166 total

@chrisseaton
Copy link
Contributor

Wow! Normally I'd say not to worry about it as it's not peak performance - but 10s is a bit insane. We risk people trying Truffle out getting a very bad impression. It might be the hash operations - we never resize remember - so I'll see if I can optimise the methods and specialisations used in converter_paths.rb.

@nirvdrum
Copy link
Contributor Author

It looks like that converter_paths load is to blame after all. I'll work on fixing that now. While big, it's a bit disconcerting that interpreted hash updates are that slow. That might warrant additional investigation.

@eregon
Copy link
Member

eregon commented Mar 27, 2015

Just parsing that file might be slow, Rbx precompiles to .rbc so that might motivate their approach.

@eregon
Copy link
Member

eregon commented Mar 29, 2015

@nirvdrum Seems much better after 53683ba:

  4.74s user 0.14s system 163% cpu 2.990 total
  4.68s user 0.15s system 161% cpu 2.999 total
  4.73s user 0.13s system 159% cpu 3.042 total

@chrisseaton chrisseaton modified the milestone: truffle-dev May 4, 2015
@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