-
Notifications
You must be signed in to change notification settings - Fork 914
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into weird_binding
- Loading branch information
Showing
2,563 changed files
with
50,167 additions
and
41,536 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
9.4.2.0-SNAPSHOT | ||
9.4.8.0-SNAPSHOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.