Skip to content

Instantly share code, notes, and snippets.

View headius's full-sized avatar

Charles Oliver Nutter headius

View GitHub Profile
## unfiltered
~/NetBeansProjects/jruby ➔ jruby -e "def foo; raise; end; foo"
-e:1:in method__0$RUBY$foo: unhandled exception
from ruby/__dash_e__Invokermethod__0$RUBY$fooFixed0.gen:-1:in call
from CompiledMethod.java:216:in call
from CallSite.java:123:in cacheAndCall
from CallSite.java:333:in call
from -e:1:in __file__
from -e:-1:in __file__
from -e:-1:in load
~/NetBeansProjects/jruby ➔ cat test/bench/bench_thread_creation.rb
require 'benchmark'
(ARGV[0] || 10).to_i.times do
Benchmark.bm(20) do |bm|
bm.report('control loop') { 10_000.times { 1 } }
bm.report('Thread.new.join loop') { 10_000.times { Thread.new { 1 }.join } }
end
end
~/NetBeansProjects/jruby ➔ jruby --server test/bench/bench_thread_creation.rb 5
~/NetBeansProjects/jruby ➔ jruby -X-C --server test/bench/bench_fib_recursive.rb 10
1.014000 0.000000 1.014000 ( 1.014428)
0.994000 0.000000 0.994000 ( 0.993519)
0.950000 0.000000 0.950000 ( 0.950080)
0.941000 0.000000 0.941000 ( 0.940958)
0.890000 0.000000 0.890000 ( 0.889348)
0.876000 0.000000 0.876000 ( 0.875789)
0.875000 0.000000 0.875000 ( 0.875409)
0.879000 0.000000 0.879000 ( 0.879723)
0.875000 0.000000 0.875000 ( 0.875625)
◆ bin/dubyc -e "a = 1; a; 1; 1 + 1; a + a"
[headius @ cnutter:~/projects/duby]
◆ javap -c dash_e
Compiled from dash_e
public class dash_e extends java.lang.Object{
public static void main(java.lang.String[]);
Code:
0: iconst_1
1: istore_0
2: iconst_1
diff --git a/src/org/jruby/java/proxies/JavaInterfaceTemplate.java b/src/org/jruby/java/proxies/JavaInterfaceTemplate.java
index 872f52d..bc6ab52 100644
--- a/src/org/jruby/java/proxies/JavaInterfaceTemplate.java
+++ b/src/org/jruby/java/proxies/JavaInterfaceTemplate.java
@@ -239,7 +239,7 @@ public class JavaInterfaceTemplate {
// we've already done the above priming logic, just add another interface
// to the list of intentions unless we're past the point of no return or
// already intend to implement the given interface
- if (!(javaInterfaces.isFrozen() || ((RubyArray)javaInterfaces).includes(context, javaClass))) {
+ if (!(javaInterfaces.isFrozen() || ((RubyArray)javaInterfaces).includes(context, javaClassObj))) {
class FeedReaderView < ApplicationView
import javax.swing.DefaultListModel
set_java_class 'org.feedmonkey.FeedReader'
map :model => :my_feed_url, :view => "feed_url.text"
map :model => :my_entry_list, :view => "entry_list.model",
:using => [:new_list_model, nil]
def new_list_model(new_list)
new_model = DefaultListModel.new
Before:
=== 10^7 ===
inject: 2.440000 0.000000 2.440000 ( 2.440096)
each: 1.504000 0.000000 1.504000 ( 1.503791)
times: 1.566000 0.000000 1.566000 ( 1.566492)
while: 0.916000 0.000000 0.916000 ( 0.915542)
◆ jruby bench/bench_fib_recursive.rb 10
0.391000 0.000000 0.391000 ( 0.391463)
◆ jruby -I ext:lib -rnokogiri -e "xml = %{<bar a='1'><\!--foo-->baz<\![CDATA[yum]]></bar>}; parser = Nokogiri::XML::SAX::Parser.new; def parser.method_missing(name, *args); p name, args; end; parser.parse_memory(xml)"
:start_document
[#<Nokogiri::XML::SAX::Document:0x452c0b3f>]
:start_element
[#<Nokogiri::XML::SAX::Document:0x452c0b3f>, "bar", ["a", "1"]]
:comment
[#<Nokogiri::XML::SAX::Document:0x452c0b3f>, "foo"]
:characters
[#<Nokogiri::XML::SAX::Document:0x452c0b3f>, "baz"]
:cdata_block
diff --git a/src/org/jruby/ext/socket/RubyTCPServer.java b/src/org/jruby/ext/socket/RubyTCPServer.java
index e313e74..17326ec 100644
--- a/src/org/jruby/ext/socket/RubyTCPServer.java
+++ b/src/org/jruby/ext/socket/RubyTCPServer.java
@@ -31,6 +31,7 @@ import java.io.FileDescriptor;
import java.io.IOException;
import java.net.BindException;
+import java.net.Inet4Address;
import java.net.InetAddress;
[headius @ cnutter:~/projects/jruby]
◆ jruby -e "loop { sleep 1; puts Process.times }"
#<struct Struct::Tms utime=1.3470001220703125, stime=0.0, cutime=0.0, cstime=0.0>
#<struct Struct::Tms utime=2.3550000190734863, stime=0.0, cutime=0.0, cstime=0.0>
#<struct Struct::Tms utime=3.3560001850128174, stime=0.0, cutime=0.0, cstime=0.0>
#<struct Struct::Tms utime=4.358000040054321, stime=0.0, cutime=0.0, cstime=0.0>
#<struct Struct::Tms utime=5.359000205993652, stime=0.0, cutime=0.0, cstime=0.0>
#<struct Struct::Tms utime=6.361000061035156, stime=0.0, cutime=0.0, cstime=0.0>
#<struct Struct::Tms utime=7.362000226974487, stime=0.0, cutime=0.0, cstime=0.0>
#<struct Struct::Tms utime=8.364000082015991, stime=0.0, cutime=0.0, cstime=0.0>