Skip to content

Commit

Permalink
Merge branch 'master' into weird_binding
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed Apr 30, 2024
2 parents f304def + e3e2432 commit e74990f
Show file tree
Hide file tree
Showing 2,563 changed files with 50,167 additions and 41,536 deletions.
425 changes: 137 additions & 288 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions .github/workflows/snapshot-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ jobs:
server-id: sonatype-nexus-snapshots
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Setup Maven Action
uses: s4u/setup-maven-action@v1.6.0
with:
java-version: '8'
maven-version: '3.8.7'
- name: Publish package
run: ./mvnw -B clean deploy -Prelease
env:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ lib/ruby/stdlib/abbrev*
lib/ruby/stdlib/ant*
lib/ruby/stdlib/base64*
lib/ruby/stdlib/benchmark*
lib/ruby/stdlib/bigdecimal*
lib/ruby/stdlib/bundler*
lib/ruby/stdlib/cgi*
lib/ruby/stdlib/csv*
Expand All @@ -86,6 +87,7 @@ lib/ruby/stdlib/jar*
lib/ruby/stdlib/jline
lib/ruby/stdlib/jopenssl*
lib/ruby/stdlib/json*
lib/ruby/stdlib/kconv.rb
lib/ruby/stdlib/krypt*
lib/ruby/stdlib/libfixposix*
lib/ruby/stdlib/logger*
Expand All @@ -94,7 +96,9 @@ lib/ruby/stdlib/minitest*
lib/ruby/stdlib/mutex_m.rb
lib/ruby/stdlib/net/protocol*
lib/ruby/stdlib/net/http*
lib/ruby/stdlib/nkf*
lib/ruby/stdlib/observer*
lib/ruby/stdlib/open3*
lib/ruby/stdlib/open-uri*
lib/ruby/stdlib/optparse*
lib/ruby/stdlib/optionparser*
Expand Down
2 changes: 1 addition & 1 deletion .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<extension>
<groupId>io.takari.polyglot</groupId>
<artifactId>polyglot-ruby</artifactId>
<version>0.4.7</version>
<version>0.5.0</version>
</extension>
</extensions>
Binary file modified .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
19 changes: 18 additions & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.8/apache-maven-3.8.8-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9.4.2.0-SNAPSHOT
9.4.8.0-SNAPSHOT
32 changes: 32 additions & 0 deletions bench/bench_csv.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Usage: jruby csv_bench.rb {ANYTHING}?. ANYTHING old csv. nothing is new one.

if ARGV.shift
puts 'Using 1.7 csv'
require_relative 'old_csv'
else
puts 'Using 9.4 csv'
require 'csv'
end

require 'benchmark'

dir = "data"
Dir.mkdir(dir) unless Dir.exist?(dir)

input = "#{dir}/extract.csv"

unless File.exist?(input)
Dir.chdir(dir) do
zip = "sirene_2017111_E_Q.zip"
system "wget", "-O", zip, "http://files.data.gouv.fr/sirene/#{zip}"
system "unzip", zip
system "head -10000 sirc* > extract.csv"
end
end

loop do
p Benchmark.realtime {
CSV.foreach(input, col_sep: ';', encoding: "ISO-8859-1:UTF-8") { |row|
}
}
end
41 changes: 41 additions & 0 deletions bench/bench_pattern_array.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
require 'benchmark/ips'

def call(*val)
case val
in [String => body]
1
in [Integer => status]
2
in [Integer, String] => response
3
in [Integer, Hash, String] => response
4
end
end

Benchmark.ips do |bm|
bm.report("first") do |i|
while i > 0
i-=1
call("ok")
end
end
bm.report("second") do |i|
while i > 0
i-=1
call(401)
end
end
bm.report("third") do |i|
while i > 0
i-=1
call(200, "ok")
end
end
bm.report("fourth") do |i|
while i > 0
i-=1
call(201, {}, "created")
end
end
end
41 changes: 41 additions & 0 deletions bench/bench_pattern_find.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
require 'benchmark/ips'

def call(*val)
case val
in [*, Integer, Hash, String] => response
1
in [*, Integer, String] => response
2
in [*, Integer => status]
3
in [*, String => body]
4
end
end

Benchmark.ips do |bm|
bm.report("first") do |i|
while i > 0
i-=1
call(nil, 201, {}, "created")
end
end
bm.report("second") do |i|
while i > 0
i-=1
call(nil, 200, "ok")
end
end
bm.report("third") do |i|
while i > 0
i-=1
call(nil, 401)
end
end
bm.report("fourth") do |i|
while i > 0
i-=1
call(nil, "ok")
end
end
end
41 changes: 41 additions & 0 deletions bench/bench_pattern_hash.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
require 'benchmark/ips'

def call(**val)
case val
in {a:1} => response
1
in {b:1} => response
2
in {c:1} => response
3
in {d:1} => response
4
end
end

Benchmark.ips do |bm|
bm.report("first") do |i|
while i > 0
i-=1
call(a:1)
end
end
bm.report("second") do |i|
while i > 0
i-=1
call(b:1)
end
end
bm.report("third") do |i|
while i > 0
i-=1
call(c:1)
end
end
bm.report("fourth") do |i|
while i > 0
i-=1
call(d:1)
end
end
end
16 changes: 16 additions & 0 deletions bench/bench_string_interpolation.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require 'benchmark'

loop {
puts Benchmark.measure {
n = 0
while n < 100000
n+=1
a = nil
i = 0
while i < 1000
i+=1
a = "foo#{n}bar"
end
end
}
}
14 changes: 14 additions & 0 deletions bench/bench_string_when.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
10.times do
t = Time.now
i = 0; while i < 100_000_000
case RUBY_ENGINE
when "foo"
when "bar"
when "baz"
when "quux"
when "jruby"
end
i += 1
end
puts Time.now - t
end
15 changes: 15 additions & 0 deletions bench/bench_symbol_when.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
100``.times do
sym = RUBY_ENGINE.to_sym
t = Time.now
i = 0; while i < 100_000_000
case sym
when :foo
when :bar
when :baz
when :quux
when :jruby
end
i += 1
end
puts Time.now - t
end
8 changes: 8 additions & 0 deletions bench/bench_yaml.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require 'psych'
require 'benchmark'

file_name = "YAML.txt"

puts Benchmark.measure {
Psych.load(File.read(file_name))
}
15 changes: 15 additions & 0 deletions bench/bench_yaml_peak.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'psych'
require 'benchmark'
require 'benchmark/ips'

file_name = "YAML.txt"

puts Benchmark.measure {Psych.load(File.read(file_name))}

Benchmark.ips do |x|
x.warmup = 5
x.iterations = 3
x.report('Psych.load') { Psych.load(File.read(file_name))}
end

puts Benchmark.measure {Psych.load(File.read(file_name))}
2 changes: 1 addition & 1 deletion bin/ast
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def ir_setup(root)
JRuby::IR.compiler_debug = true


builder = org.jruby.ir.IRBuilder
builder = org.jruby.ir.builder.IRBuilderAST

scope = builder.build_root(manager, root).scope
scope.prepare_for_compilation
Expand Down

0 comments on commit e74990f

Please sign in to comment.