Skip to content

Instantly share code, notes, and snippets.

View headius's full-sized avatar

Charles Oliver Nutter headius

View GitHub Profile
@headius
headius / ffi-jep.md
Last active January 26, 2016 00:57
JDK Enhancement Proposal: FFI

Title: Foreign Function Interface Author: Charles Oliver Nutter Organization: Red Hat Owner: Charles Oliver Nutter Created: 2014/01/28 Type: Feature State: Draft Exposure: Open Component: --/-- Scope: JDK

[subbu@earth ir] cat !$
cat ~/bin/runspecs
#!/bin/sh
if [ $1 ]
then
echo "Running all specs with passes $1"
jruby -J-ea -X-CIR -Xir.passes=$1 -J-Djruby.launch.inproc=true -S spec/mspec/bin/mspec ci -B spec/jruby.1.9.spec -V -T -J-Djruby.compile.mode=OFFIR -T -J-Djruby.ir.passes=$1
else
echo "Running all specs with default passes"
@nateberkopec
nateberkopec / gist:11dbcf0ee7f2c08450ea
Last active March 24, 2023 21:59
RubySpec is dead, long live RubySpec!

Last night, Brian Shirai unilaterally "ended" the RubySpec project, a sub-project of Rubinius (the alternative Ruby implementation which Brian was paid to work on full-time from 2007 to 2013). The blog post describing his reasons for "ending" the project led to a big discussion on Hacker News.

When a single, competing Ruby implementation tells that you its test suite is the One True Way, you should be skeptical. Charles Nutter, Ruby core committer and JRuby head honcho, spent a lot of time last night on Twitter talking to people about what this decision means. He's probably too busy and certainly too nice of a guy to write about what is a political issue in the Ruby community, so I'm going to do it on behalf of all the new or intermediate Rubyists out there that are confused by Brian's decision and what it me

#!/usr/bin/env jruby
require 'rubygems'
require 'fileutils'
require 'optparse'
ENV['RAILS_ENV'] = "development"
launcher, options = "jruby", ""
OptionParser.new do |opt|
opt.banner = "Usage: runner [OPTIONS]"

The problem:

For an HTTP 1.1 request. JRuby's packet sequence goes like this:

  1. The request is sent from the client
  2. The server sends a packet back with the 200 OK, headers, and ack of the request
  3. The client sends an ack of the headers
  4. The server sends the body of the request

On Linux with delayed ACK, there's around 0.04 seconds between (2) and (3), which drastically reduces throughput.

@mtortonesi
mtortonesi / profile_all.sh
Created June 19, 2020 20:41
Profiling script for sisfc
#!/bin/sh
TIME_BASED_ID=$(date +%Y%m%d%H%M%S)
rbenv local jruby-9.2.11.1
export JRUBY_OPTS="-Xcompile.invokedynamic=true"
time bundle exec ./bin/sisfc examples/simulator.conf examples/vm_allocation.conf 2>&1 | tee log_sisfc_jruby_${TIME_BASED_ID}.txt
rbenv local 2.7.1
time bundle exec ./bin/sisfc examples/simulator.conf examples/vm_allocation.conf 2>&1 | tee log_sisfc_mri_${TIME_BASED_ID}.txt
`curl -OL https://repo1.maven.org/maven2/org/jruby/jruby-dist/9.3.3.0/jruby-dist-9.3.3.0-bin.tar.gz` unless File.exist?('jruby-dist-9.3.3.0-bin.tar.gz')
`tar -zxf jruby-dist-9.3.3.0-bin.tar.gz` unless Dir.exist?('jruby-9.3.3.0')
`curl -OL https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/graalvm-ce-java17-darwin-amd64-22.0.0.2.tar.gz` unless File.exist?('graalvm-ce-java17-darwin-amd64-22.0.0.2.tar.gz')
`tar -zxf graalvm-ce-java17-darwin-amd64-22.0.0.2.tar.gz` unless Dir.exist?('graalvm-ce-java17-22.0.0.2')
`gem install seafoam`
IO.popen({'JAVA_HOME' => 'graalvm-ce-java17-22.0.0.2/Contents/Home'}, ['jruby-9.3.3.0/bin/jruby', '-J-XX:CompileOnly=DashE::RUBY$method$foo$1', '-J-XX:+PrintCompilation', '-J-Dgraal.Dump=', '-e', 'def foo(a, b); a + b; end; loop { foo(rand(100), rand(100)) }']) do |pipe|
puts 'Running...'