Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #735 from larskanis/disallow-re-layout
Disallow struct layout changes
- Loading branch information
Showing
42 changed files
with
2,487 additions
and
2,381 deletions.
There are no files selected for viewing
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,24 +1,26 @@ | ||
require_relative 'bench_helper' | ||
|
||
module LibTest | ||
extend FFI::Library | ||
ffi_lib LIBTEST_PATH | ||
attach_function :bench_f32f32f32_v, [ :float, :float, :float ], :void | ||
def self.rb_bench(a0, a1, a2); nil; end | ||
end | ||
module BenchFFFrV | ||
module LibTest | ||
extend FFI::Library | ||
ffi_lib LIBTEST_PATH | ||
attach_function :bench_f32f32f32_v, [ :float, :float, :float ], :void | ||
def self.rb_bench(a0, a1, a2); nil; end | ||
end | ||
|
||
|
||
puts "Benchmark [ :float, :float, :float ], :void performance, #{ITER}x calls" | ||
f = 1.0 | ||
10.times { | ||
puts Benchmark.measure { | ||
ITER.times { LibTest.bench_f32f32f32_v(f, f, f) } | ||
puts "Benchmark [ :float, :float, :float ], :void performance, #{ITER}x calls" | ||
f = 1.0 | ||
10.times { | ||
puts Benchmark.measure { | ||
ITER.times { LibTest.bench_f32f32f32_v(f, f, f) } | ||
} | ||
} | ||
} | ||
|
||
puts "Benchmark ruby method(1 arg) performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
ITER.times { LibTest.rb_bench(f, f, f) } | ||
puts "Benchmark ruby method(1 arg) performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
ITER.times { LibTest.rb_bench(f, f, f) } | ||
} | ||
} | ||
} | ||
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 |
---|---|---|
@@ -1,36 +1,38 @@ | ||
require_relative 'bench_helper' | ||
|
||
module LibTest | ||
extend FFI::Library | ||
ffi_lib LIBTEST_PATH | ||
attach_function :bench_f32_v, [ :float ], :void | ||
def self.rb_bench(i0); nil; end | ||
end | ||
module BenchFrV | ||
module LibTest | ||
extend FFI::Library | ||
ffi_lib LIBTEST_PATH | ||
attach_function :bench_f32_v, [ :float ], :void | ||
def self.rb_bench(i0); nil; end | ||
end | ||
|
||
|
||
puts "Benchmark [ :float ], :void performance, #{ITER}x calls" | ||
f = 1.0 | ||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.bench_f32_v(f) | ||
LibTest.bench_f32_v(f) | ||
LibTest.bench_f32_v(f) | ||
LibTest.bench_f32_v(f) | ||
i += 4 | ||
end | ||
puts "Benchmark [ :float ], :void performance, #{ITER}x calls" | ||
f = 1.0 | ||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.bench_f32_v(f) | ||
LibTest.bench_f32_v(f) | ||
LibTest.bench_f32_v(f) | ||
LibTest.bench_f32_v(f) | ||
i += 4 | ||
end | ||
} | ||
} | ||
} | ||
|
||
puts "Benchmark ruby method(1 arg) performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.rb_bench(f) | ||
LibTest.rb_bench(f) | ||
LibTest.rb_bench(f) | ||
LibTest.rb_bench(f) | ||
i += 4 | ||
end | ||
puts "Benchmark ruby method(1 arg) performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.rb_bench(f) | ||
LibTest.rb_bench(f) | ||
LibTest.rb_bench(f) | ||
LibTest.rb_bench(f) | ||
i += 4 | ||
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 |
---|---|---|
@@ -1,29 +1,30 @@ | ||
require_relative 'bench_helper' | ||
|
||
module LibTest | ||
extend FFI::Library | ||
ffi_lib LIBTEST_PATH | ||
attach_function :ffi_bench, 'bench_s32s32s32s32s32s32_v', [ :int, :int, :int, :int, :int, :int ], :void, :save_errno => false | ||
def self.rb_bench(i0, i1, i2, i3, i4, i5); nil; end | ||
end | ||
module BenchIIIIIIrV | ||
module LibTest | ||
extend FFI::Library | ||
ffi_lib LIBTEST_PATH | ||
attach_function :ffi_bench, 'bench_s32s32s32s32s32s32_v', [ :int, :int, :int, :int, :int, :int ], :void, :save_errno => false | ||
def self.rb_bench(i0, i1, i2, i3, i4, i5); nil; end | ||
end | ||
|
||
puts "Benchmark [ :int, :int, :int, :int, :int, :int ], :void performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.ffi_bench(1, 2, 3, 4, 5, 6) | ||
i += 1 | ||
end | ||
puts "Benchmark [ :int, :int, :int, :int, :int, :int ], :void performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.ffi_bench(1, 2, 3, 4, 5, 6) | ||
i += 1 | ||
end | ||
} | ||
} | ||
} | ||
|
||
puts "Benchmark ruby method(6 arg) performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.rb_bench(0, 1, 2, 3, 4, 5) | ||
i += 1 | ||
end | ||
puts "Benchmark ruby method(6 arg) performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.rb_bench(0, 1, 2, 3, 4, 5) | ||
i += 1 | ||
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 |
---|---|---|
@@ -1,15 +1,17 @@ | ||
require_relative 'bench_helper' | ||
|
||
module LibTest | ||
extend FFI::Library | ||
ffi_lib LIBTEST_PATH | ||
attach_function :bench, :bench_s32s32s32_v, [ :int, :int, :int ], :int | ||
end | ||
module BenchIIIrI | ||
module LibTest | ||
extend FFI::Library | ||
ffi_lib LIBTEST_PATH | ||
attach_function :bench, :bench_s32s32s32_v, [ :int, :int, :int ], :int | ||
end | ||
|
||
|
||
puts "Benchmark [ :int, :int, :int ], :int performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
ITER.times { LibTest.bench(0, 1, 2) } | ||
puts "Benchmark [ :int, :int, :int ], :int performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
ITER.times { LibTest.bench(0, 1, 2) } | ||
} | ||
} | ||
} | ||
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 |
---|---|---|
@@ -1,28 +1,30 @@ | ||
require_relative 'bench_helper' | ||
|
||
module LibTest | ||
extend FFI::Library | ||
ffi_lib LIBTEST_PATH | ||
attach_function :ffi_bench, :bench_s32s32s32_v, [ :int, :int, :int ], :void, :save_errno => false | ||
def self.rb_bench(i0, i1, i2); nil; end | ||
end | ||
module BenchIIIrV | ||
module LibTest | ||
extend FFI::Library | ||
ffi_lib LIBTEST_PATH | ||
attach_function :ffi_bench, :bench_s32s32s32_v, [ :int, :int, :int ], :void, :save_errno => false | ||
def self.rb_bench(i0, i1, i2); nil; end | ||
end | ||
|
||
puts "Benchmark [ :int, :int, :int ], :void performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.ffi_bench(0, 1, 2) | ||
i += 1 | ||
end | ||
puts "Benchmark [ :int, :int, :int ], :void performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.ffi_bench(0, 1, 2) | ||
i += 1 | ||
end | ||
} | ||
} | ||
} | ||
|
||
puts "Benchmark ruby method(3 arg) performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.rb_bench(0, 1, 2) | ||
i += 1 | ||
end | ||
puts "Benchmark ruby method(3 arg) performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.rb_bench(0, 1, 2) | ||
i += 1 | ||
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 |
---|---|---|
@@ -1,34 +1,36 @@ | ||
require_relative 'bench_helper' | ||
|
||
module LibTest | ||
extend FFI::Library | ||
ffi_lib LIBTEST_PATH | ||
attach_function :ffi_bench, :bench_s32_v, [ :int ], :void, :save_errno => false | ||
def self.rb_bench(i0); nil; end | ||
end | ||
module BenchIrV | ||
module LibTest | ||
extend FFI::Library | ||
ffi_lib LIBTEST_PATH | ||
attach_function :ffi_bench, :bench_s32_v, [ :int ], :void, :save_errno => false | ||
def self.rb_bench(i0); nil; end | ||
end | ||
|
||
puts "Benchmark [ :int ], :void performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.ffi_bench(0) | ||
LibTest.ffi_bench(0) | ||
LibTest.ffi_bench(0) | ||
LibTest.ffi_bench(0) | ||
i += 4 | ||
end | ||
puts "Benchmark [ :int ], :void performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.ffi_bench(0) | ||
LibTest.ffi_bench(0) | ||
LibTest.ffi_bench(0) | ||
LibTest.ffi_bench(0) | ||
i += 4 | ||
end | ||
} | ||
} | ||
} | ||
|
||
puts "Benchmark ruby method(1 arg) performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.rb_bench(0) | ||
LibTest.rb_bench(0) | ||
LibTest.rb_bench(0) | ||
LibTest.rb_bench(0) | ||
i += 4 | ||
end | ||
puts "Benchmark ruby method(1 arg) performance, #{ITER}x calls" | ||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.rb_bench(0) | ||
LibTest.rb_bench(0) | ||
LibTest.rb_bench(0) | ||
LibTest.rb_bench(0) | ||
i += 4 | ||
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 |
---|---|---|
@@ -1,20 +1,21 @@ | ||
require_relative 'bench_helper' | ||
|
||
module LibTest | ||
extend FFI::Library | ||
ffi_lib LIBTEST_PATH | ||
attach_function :bench_s64s64s64_v, [ :long_long, :long_long, :long_long ], :void, :save_errno => false | ||
end | ||
module BenchLLLrV | ||
module LibTest | ||
extend FFI::Library | ||
ffi_lib LIBTEST_PATH | ||
attach_function :bench_s64s64s64_v, [ :long_long, :long_long, :long_long ], :void, :save_errno => false | ||
end | ||
|
||
|
||
puts "Benchmark [ :long_long, :long_long, :long_long ], :void performance, #{ITER}x calls" | ||
puts "Benchmark [ :long_long, :long_long, :long_long ], :void performance, #{ITER}x calls" | ||
|
||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.bench_s64s64s64_v(0, 1, 2) | ||
i += 1 | ||
end | ||
10.times { | ||
puts Benchmark.measure { | ||
i = 0; while i < ITER | ||
LibTest.bench_s64s64s64_v(0, 1, 2) | ||
i += 1 | ||
end | ||
} | ||
} | ||
} | ||
|
||
end |
Oops, something went wrong.