topazproject / topaz

A high performance ruby, written in RPython
topazruby.com
BSD 3-Clause "New" or "Revised" License
1k stars 85 forks source link

JIT not tracing through Timsort and not virtualizing through ordereddict #833

Open timfel opened 10 years ago

timfel commented 10 years ago

This is the reason we are so slow on the "Acid" benchmark presented here: http://www.chrisseaton.com/rubytruffle/pushing-pixels/

alex commented 10 years ago

Where would you expect it to trace in Timsort? Is the problem that the comparator isn't inlined?

Can you show a small trace with an example of the orderreddict?

alex commented 10 years ago

Can you let me know if #834 helped?

Is:

module Foo
  extend self

  def foo(a, b, c)
    hash = {a: a, b: b, c: c}
    array = hash.map { |k, v| v }
    x = array[0]
    y = [a, b, c].sort[1]
    x + y
  end

end

class Bar

  def method_missing(method, *args)
    if Foo.respond_to?(method)
      Foo.send(method, *args)
    else
      0
    end
  end

end

bar = Bar.new

loop do
  start = Time.now

  1_000_000.times do
    # This block should be compiled to the constant Fixnum value 22
    bar.foo(14, 8, 6)
  end

  puts Time.now - start
end

the snippet to benchmark? If yes, I can probably run it myself.

alex commented 10 years ago

It looks like the next issue is the Hash#map, we need to unroll stuff in Ruby, and I'm not sure how that would look.

alex commented 10 years ago

I guess, Interpreter.jump should just not call can_enter_jit... if something.

timfel commented 10 years ago

I'm guessing one thing that would help on this benchmark are storage strategies. A student at HPI has been extracting the commonolaties into an rlib library that he demonstrated to work in lang-smalltalk, pycket, and topaz. I've asked him to coordinate with cfbolz to get the library into shape and I'll get him to run this with strategies.

alex commented 10 years ago

Oooh, that's awesome.

On Thu, Oct 16, 2014 at 9:30 AM, Tim Felgentreff notifications@github.com wrote:

I'm guessing one thing that would help on this benchmark are storage strategies. A student at HPI has been extracting the commonolaties into an rlib library that he demonstrated to work in lang-smalltalk, pycket, and topaz. I've asked him to coordinate with cfbolz to get the library into shape and I'll get him to run this with strategies.

— Reply to this email directly or view it on GitHub https://github.com/topazproject/topaz/issues/833#issuecomment-59390167.

"I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero GPG Key fingerprint: 125F 5C67 DFE9 4084