I'm seeing my ffi version of chipmunk bindings are about 10 times slower. Can any experts take a look and tell me if I'm doing something wrong?
http://github.com/shawn42/chipmunk-ffi
you will need ffi 0.6 and nice-ffi 0.2 and chipmunk built from svn (
http://code.google.com/p/chipmunk-physics/source/checkout )
/Shawn
perf test:
require 'rubygems'
require 'benchmark'
n = 10000
Benchmark.bm do |x|
# old bindings
require 'chipmunk'
x.report("cp vec2 ") {
n.times do
vec2(4,3)
end
}
x.report("cp vec2 sub") {
n.times do
vec2(4,3)-vec2(5,6)
end
}
# new bindings
require 'chipmunk-ffi'
x.report("cp-ffi vec2") {
n.times do
vec2(4,3)
end
}
x.report("cp vec2 ffi sub") {
n.times do
vec2(4,3)-vec2(5,6)
end
}
end