Permalink
Browse files

Merge branch 'master' into constant_optz

Conflicts:
	src/org/jruby/Ruby.java
	src/org/jruby/RubyModule.java
	src/org/jruby/compiler/CacheCompiler.java
	src/org/jruby/javasupport/util/RuntimeHelpers.java
	src/org/jruby/runtime/invokedynamic/InvokeDynamicSupport.java
  • Loading branch information...
2 parents 8e852ac + 54ecbe4 commit 8d0a7c435e51faa3873a7948d9a9b4141a9bd04d @headius headius committed Nov 7, 2011
Showing 796 changed files with 20,984 additions and 16,815 deletions.
View
@@ -11,7 +11,6 @@
<accessrule kind="discouraged" pattern="sun/misc/SignalHandler"/>
</accessrules>
</classpathentry>
- <classpathentry kind="lib" path="build_lib/snakeyaml-1.8.jar"/>
<classpathentry kind="lib" path="build_lib/junit.jar"/>
<classpathentry kind="lib" path="build_lib/jline-1.0.jar"/>
<classpathentry kind="lib" path="build_lib/bsf.jar"/>
@@ -28,15 +27,17 @@
<classpathentry kind="lib" path="build_lib/nailgun-0.7.1.jar"/>
<classpathentry kind="lib" path="build_lib/jnr-posix.jar"/>
<classpathentry kind="lib" path="build_lib/joda-time-1.6.2.jar"/>
- <classpathentry kind="lib" path="build_lib/jgrapht-jdk1.5.jar"/>
<classpathentry kind="lib" path="build_lib/livetribe-jsr223-2.0.6.jar"/>
- <classpathentry kind="lib" path="build_lib/asm-4.0_RC1.jar"/>
- <classpathentry kind="lib" path="build_lib/asm-analysis-4.0_RC1.jar"/>
- <classpathentry kind="lib" path="build_lib/asm-commons-4.0_RC1.jar"/>
- <classpathentry kind="lib" path="build_lib/asm-tree-4.0_RC1.jar"/>
- <classpathentry kind="lib" path="build_lib/asm-util-4.0_RC1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/ANT"/>
<classpathentry kind="lib" path="build_lib/jnr-netdb.jar"/>
<classpathentry kind="lib" path="build_lib/org.osgi.core-4.2.0.jar"/>
+ <classpathentry kind="lib" path="build_lib/asm-4.0.jar"/>
+ <classpathentry kind="lib" path="build_lib/asm-analysis-4.0.jar"/>
+ <classpathentry kind="lib" path="build_lib/asm-commons-4.0.jar"/>
+ <classpathentry kind="lib" path="build_lib/asm-tree-4.0.jar"/>
+ <classpathentry kind="lib" path="build_lib/asm-util-4.0.jar"/>
+ <classpathentry kind="lib" path="build_lib/snakeyaml-1.9.jar"/>
+ <classpathentry kind="lib" path="build_lib/jzlib-1.1.0.jar"/>
+ <classpathentry kind="lib" path="build_lib/coro-mock-1.0-SNAPSHOT.jar"/>
<classpathentry kind="output" path="build.eclipse"/>
</classpath>
View
@@ -63,4 +63,5 @@ dev_null
.idea/workspace.xml
shared.iml
build_graph.png
-/.idea/
+/.idea/
+/.rbx/
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: org.jruby.extras:constantine:0.6">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/org/jruby/extras/constantine/0.6/constantine-0.6.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/org/jruby/extras/constantine/0.6/constantine-0.6-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/org/jruby/extras/constantine/0.6/constantine-0.6-sources.jar!/" />
- </SOURCES>
- </library>
-</component>
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: org.jruby.extras:jffi:1.0.8">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/org/jruby/extras/jffi/1.0.8/jffi-1.0.8.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/org/jruby/extras/jffi/1.0.8/jffi-1.0.8-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/org/jruby/extras/jffi/1.0.8/jffi-1.0.8-sources.jar!/" />
- </SOURCES>
- </library>
-</component>
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: org.jruby.extras:jffi:native:1.0.7">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/org/jruby/extras/jffi/1.0.7/jffi-1.0.7-native.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/org/jruby/extras/jffi/1.0.7/jffi-1.0.7-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/org/jruby/extras/jffi/1.0.7/jffi-1.0.7-sources.jar!/" />
- </SOURCES>
- </library>
-</component>
@@ -1,13 +0,0 @@
-<component name="libraryTable">
- <library name="Maven: org.jruby.extras:jnr-netdb:1.0.3">
- <CLASSES>
- <root url="jar://$MAVEN_REPOSITORY$/org/jruby/extras/jnr-netdb/1.0.3/jnr-netdb-1.0.3.jar!/" />
- </CLASSES>
- <JAVADOC>
- <root url="jar://$MAVEN_REPOSITORY$/org/jruby/extras/jnr-netdb/1.0.3/jnr-netdb-1.0.3-javadoc.jar!/" />
- </JAVADOC>
- <SOURCES>
- <root url="jar://$MAVEN_REPOSITORY$/org/jruby/extras/jnr-netdb/1.0.3/jnr-netdb-1.0.3-sources.jar!/" />
- </SOURCES>
- </library>
-</component>
View
@@ -32,7 +32,7 @@ end
desc "Generate sources, compile and add to jar file"
task :gen do
mkdir_p 'src_gen'
- system 'apt -nocompile -cp lib/jruby.jar:build_lib/asm-3.0.jar:build_lib/asm-util-3.0.jar -factory org.jruby.anno.AnnotationBinder src/org/jruby/*.java'
+ system 'apt -nocompile -cp lib/jruby.jar:build_lib/asm-4.0_RC1.jar:build_lib/asm-util-4.0_RC1.jar -factory org.jruby.anno.AnnotationBinder src/org/jruby/*.java'
system 'javac -cp lib/jruby.jar src_gen/*.java'
system 'jar -uf lib/jruby.jar -C src_gen .'
end
@@ -0,0 +1,123 @@
+###
+# I'm running like this:
+#
+# ruby -I lib:../../i18n/lib zomg.rb
+#
+require 'rubygems'
+require 'abstract_controller'
+require 'action_controller'
+require 'action_view'
+require 'action_dispatch'
+require 'active_support/dependencies'
+require 'action_controller/caching'
+require 'action_controller/caching/sweeping'
+
+require 'active_support/ordered_options'
+require 'benchmark'
+
+class MyTest
+ class BasicController
+ attr_reader :request, :config
+
+ def initialize config
+ super()
+ @config = config
+ end
+ end
+
+ include ActionView::Helpers::AssetTagHelper
+ include ActionView::Helpers::TagHelper
+
+ attr_reader :config, :controller
+
+ def initialize
+ @config = ActiveSupport::InheritableOptions.new(ActionController::Base.config)
+ public_dir = File.expand_path("public", __FILE__)
+ @config.assets_dir = public_dir
+ @config.javascripts_dir = "#{public_dir}/javascripts"
+ @config.stylesheets_dir = "#{public_dir}/stylesheets"
+
+ @controller = BasicController.new @config
+ ActionView::Helpers::AssetTagHelper::register_javascript_expansion :defaults => ['prototype', 'effects', 'dragdrop', 'controls', 'rails']
+ end
+
+ def one_file
+ javascript_include_tag("bank")
+ end
+
+ def all
+ javascript_include_tag(:all)
+ end
+
+ def with_lang
+ javascript_include_tag("bank", :lang => 'vbscript')
+ end
+
+ def defaults
+ javascript_include_tag(:defaults)
+ end
+
+ def recursive
+ javascript_include_tag(:all, :recursive => true)
+ end
+end
+
+require 'benchmark/ips'
+
+test = MyTest.new
+
+class Blah
+ def initialize
+ @a = 1
+ @b = 2
+ @c = 3
+ @d = 4
+ end
+end
+
+Benchmark.ips do |x|
+
+ # obj = Object.new
+
+ # x.report "obj.dup" do
+ # obj.dup
+ # end
+
+ # blah = Blah.new
+
+ # x.report "blah.dup" do
+ # blah.dup
+ # end
+
+ h = { "a" => "1", "b" => "2" }
+
+ # hc = Hash
+
+ # x.report "replace" do
+ # hc.allocate.replace(h)
+ # end
+
+ # x.report "dup" do
+ # h.dup
+ # end
+
+ 2.times do
+ x.report "stringify" do
+ h.stringify_keys
+ end
+ end
+
+ 2.times do
+ x.report "keys" do
+ h.keys
+ end
+ end
+
+ # x.report('one') {
+ # test.one_file
+ # }
+
+ # x.report('defaults') {
+ # test.defaults
+ # }
+end
View
@@ -1,7 +1,26 @@
require 'benchmark'
+ARR = [false, false, false, false, false, false, false, false, false, false]
+
+class NotArray
+ include Enumerable
+
+ def each
+ yield false
+ yield false
+ yield false
+ yield false
+ yield false
+ yield false
+ yield false
+ yield false
+ yield false
+ yield false
+ end
+end
+
def bench_enumerable(bm)
- arr = [false, false, false, false, false, false, false, false, false, false]
+ arr = ARR
bm.report("1m array.any?, 10-false array") do
i = 0
@@ -10,6 +29,16 @@ def bench_enumerable(bm)
i+=1
end
end
+
+ not_array = NotArray.new
+ bm.report("1m array.any?, 10-false eachable object") do
+ i = 0
+ while i<1000000
+ not_array.any?
+ i+=1
+ end
+ end
+
end
if $0 == __FILE__
View
@@ -1,4 +1,9 @@
-require 'benchmark'
+require 'rubygems'
+begin
+ require 'benchmark/ips'
+rescue loadError
+ fail "install the benchmark-suite gem"
+end
ONE = 1
TWO = 2
@@ -22,6 +27,16 @@ def fib_ruby(n)
end
end
+def fib_ruby1(n)
+ a = 1
+ b = 2
+ if n < b
+ n
+ else
+ fib_ruby(n - b) + fib_ruby(n - a)
+ end
+end
+
def fib_ruby2(n)
if n < TWO
n
@@ -46,15 +61,26 @@ def fib_ruby4(n)
end
end
-TIMES = (ARGV[0] || 5).to_i
N = (ARGV[1] || 30).to_i
-TIMES.times {
- puts "normal fib"
- puts Benchmark.measure { puts fib_ruby(N) }
- puts "fib with constants"
- puts Benchmark.measure { puts fib_ruby2(N) }
- puts "fib with additional calls"
- puts Benchmark.measure { puts fib_ruby3(N) }
- puts "fib with constants and additional calls"
- puts Benchmark.measure { puts fib_ruby4(N) }
-}
+
+Benchmark.ips do |x|
+ x.report "normal fib" do
+ fib_ruby(N)
+ end
+
+ x.report "fib with variables" do
+ fib_ruby1(N)
+ end
+
+ x.report "fib with constants" do
+ fib_ruby2(N)
+ end
+
+ x.report "fib with additional calls" do
+ fib_ruby3(N)
+ end
+
+ x.report "fib with constants and additional calls" do
+ fib_ruby4(N)
+ end
+end
@@ -0,0 +1,25 @@
+require 'benchmark'
+
+def fractal_flipflop
+ w, h = 44, 54
+ c = 7 + 42 * w
+ a = [0] * w * h
+ g = d = 0
+ f = proc do |n|
+ a[c] += 1
+ o = a.map {|z| " :#"[z, 1] * 2 }.join.scan(/.{#{w * 2}}/)
+ puts "\f" + o.map {|l| l.rstrip }.join("\n")
+ d += 1 - 2 * ((g ^= 1 << n) >> n)
+ c += [1, w, -1, -w][d %= 4]
+ end
+ 1024.times do
+ !!(!!(!!(!!(!!(!!(!!(!!(!!(true...
+ f[0])...f[1])...f[2])...
+ f[3])...f[4])...f[5])...
+ f[6])...f[7])...f[8])
+ end
+end
+
+(ARGV[0] || 5).to_i.times do
+ puts Benchmark.measure { fractal_flipflop }
+end
View
@@ -2,10 +2,19 @@
require 'benchmark'
Ruby = org.jruby.Ruby
+Cfg = org.jruby.RubyInstanceConfig
System = java.lang.System
-Benchmark.bm(20) { |bench|
- bench.report("100 JRuby runtime inits") {
- 100.times { Ruby.newInstance(System.in, System.out, System.err) }
+args = ARGV[1]
+
+(ARGV[0] || 5).to_i.times do
+ Benchmark.bm(20) { |bench|
+ bench.report("in-process `jruby #{args}`") {
+ cfg = Cfg.new
+ if args
+ cfg.process_arguments args.split.to_java(:string)
+ end
+ Ruby.newInstance(cfg)
+ }
}
-}
+end
Oops, something went wrong.

0 comments on commit 8d0a7c4

Please sign in to comment.