Project

General

Profile

Actions

Bug #11559

closed

ビジーループの thread と YAML.parse を組み合わせたときの実行時間が 2.2.3 で遅くなっている

Added by takkanm (三村 益隆) over 8 years ago. Updated over 8 years ago.

Status:
Closed
Target version:
-
[ruby-dev:<unknown>]

Description

ビジーループするスレッドと YAML.parse を並行して実行するような以下のようなコードが 2.2.2 と 2.2.3 で、
数倍遅くなっているようです。trunk でも遅いことを確認してます。

require 'thread'
require 'yaml'

puts RUBY_VERSION

y = (1..1000).to_a.to_yaml
t = Thread.new do
  while true; 1;end
end

10.times do
  YAML.load(y)
end

t.kill

実行結果

$ time ruby thread_loop_with_while.rb 
2.2.2
ruby thread_loop_with_while.rb  0.30s user 0.06s system 94% cpu 0.375 total

$ time ruby thread_loop_with_loop.rb
2.2.3
ruby thread_loop_with_loop.rb  1.80s user 0.05s system 99% cpu 1.864 total

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #11060: load(fifo) blocks whole processClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0