Benoit Daloze
Benoit Daloze
Thanks for the report (internal issue: GR-29306). Some numbers on my local machine, for ```ruby require 'psych' require 'benchmark' file_name = "YAML.txt" puts Benchmark.measure { Psych.load(File.read(file_name)) } ``` with ```...
[`yaml_parser_scan_plain_scalar`](https://github.com/oracle/truffleruby/blob/f6b387c4e239dec178094b4247cf4a3c5bc3b04f/src/main/c/psych/yaml/scanner.c#L3384-L3578) is a big huge function (AST 1528, IR 3481/11495, CodeSize 64169), and it seems Sulong takes a long time to compile it (~500ms), and it's compiled rather late. Also...
A [flamegraph](https://eregon.me/svg/flamegraph_20201015-190336.svg) using: ``` jt -u native profile --engine.MultiTier --metrics-profile-require=detail bench_yaml.rb ``` shows (total) 60% in `parse`, 17% in `Psych::Nodes::Node#to_ruby`, 23% in `require psych`. (RubyGems is required but it shouldn't...
I'm rerunning this with: ```ruby require 'psych' require 'benchmark' require 'benchmark/ips' file_name = "YAML.txt" puts Benchmark.measure {Psych.load(File.read(file_name))} Benchmark.ips do |x| x.iterations = 2 x.report('Psych.load') { Psych.load(File.read(file_name))} end puts Benchmark.measure {Psych.load(File.read(file_name))}...
JVM CE profile, I used `x.iterations = 3`: `rb_ary_store` seems way too high. ``` $ ruby --cpusampler --cpusampler.Mode=roots bench_yaml.rb ---------------------------------------------------------------------------------------------------------------------------------------------------- Thread: Thread[main,5,main] Name | Total Time | Opt % ||...
After optimizing rb_funcallv_public() to not call rb_ary_new_from_values but directly unwrap the passed `VALUE*`, JVM CE is significantly faster on peak than CRuby! ``` 41.520555 0.445382 41.965937 ( 3.642403) Warming up...
Improvements to rb_funcallv*() are now merged: https://github.com/oracle/truffleruby/commit/a50c8e527b92f48c8ac096e8172fbd2dcd181575
I have tried with a native libyaml instead of the bundled one, by removing `--enable-bundled-libyaml` in `src/main/c/Makefile`. Here is a branch with that: https://github.com/oracle/truffleruby/compare/master...eregon:truffleruby:use-system-yaml `ruby -ryaml -e 'p Psych.libyaml_version'` prints...
Rerunning this on Native CE: TruffleRuby master 2031318c8309bc0874df7f5b037c3281ee64a7dd: ``` 25.194098 0.933028 26.127126 ( 7.197953) 25.284336 0.923600 26.207936 ( 7.119082) 25.757382 0.892540 26.649922 ( 7.150440) 23.867417 0.921593 24.789010 ( 6.775556) Warming...
Given upstream is removing the bundling of libyaml (https://bugs.ruby-lang.org/issues/18571, in Ruby 3.2), I think the simplest option here is to just add libyaml as a dependency, and then use the...