[ruby-core:88385] [Ruby trunk Feature#14954] Add :wait option to RubyVM::MJIT.pause

From: eregontp@...
Date: 2018-08-09 10:12:03 UTC
List: ruby-core #88385
Issue #14954 has been updated by Eregon (Benoit Daloze).


Just a thought:
Pausing MJIT for benchmarks, even microbenchmarks, might have quite unintended effects once there is some profiling (e.g. branch profiling, type profiling, value profiling, etc) or if the JIT is sensitive to the calling context (for example with inlining).
With any of those, the actual measurement phase might look different than the warmup phase to the JIT and as a result run the benchmarked method(s) with the non-JIT version of the method(s).
Ideally the warmup phase looks identical to the measurement phase but this is quite tricky to achieve and there certainly are differences in e.g. benchmark-driver and benchmark-ips currently.

----------------------------------------
Feature #14954: Add :wait option to RubyVM::MJIT.pause
https://bugs.ruby-lang.org/issues/14954#change-73432

* Author: k0kubun (Takashi Kokubun)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
## Problem
To measure an MJIT-generated code's performance, currently we need to do `sleep ...; RubyVM::MJIT.pause` and it's hard to decide an appropriate sleep seconds.

## Solution
Add an :wait option (default: true) and:

~~~ ruby
# Wait for finishing all of queued compilations, and pause MJIT worker (different from the current behavior).
# This will be convenient for most of micro benchmarks. So I wanna make it default. It will be breaking but MJIT.pause is not released anywhere.
RubyVM::MJIT.pause
RubyVM::MJIT.pause(wait: true)

# Wait only for a currently-compiled method, and pause MJIT worker immediately (the current behavior).
# This will be convenient when there are many methods, like on Rails.
RubyVM::MJIT.pause(wait: false)
~~~



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next