зеркало из https://github.com/github/ruby.git
30f2d69825
Ref: https://bugs.ruby-lang.org/issues/20641 Even without the reference bug, `require 'date'` isn't cheap. ```ruby require "benchmark/ips" require "yaml" require "date" 100.times do |i| $LOAD_PATH.unshift("/tmp/does/not/exist/#{i}") end payload = 100.times.map { Date.today }.to_yaml Benchmark.ips do |x| x.report("100 dates") { YAML.unsafe_load(payload) } end ``` Before: ``` $ ruby /tmp/bench-yaml.rb ruby 3.2.2 (2023-03-30 revision |
||
---|---|---|
.. | ||
lib | ||
.gitignore | ||
depend | ||
extconf.rb | ||
psych.c | ||
psych.gemspec | ||
psych.h | ||
psych_emitter.c | ||
psych_emitter.h | ||
psych_parser.c | ||
psych_parser.h | ||
psych_to_ruby.c | ||
psych_to_ruby.h | ||
psych_yaml_tree.c | ||
psych_yaml_tree.h |