simple.rb
code = <<END
class Adder
def add_two(x)
x+2
end
end
ext-jruby-local ~/projects/jruby $ jruby --2.0 --version | |
jruby 1.7.3.dev (2.0.0dev) 2013-01-24 0a82737 on Java HotSpot(TM) 64-Bit Server VM 1.6.0_37-b06-434-11M3909 [darwin-x86_64] | |
ext-jruby-local ~/projects/jruby $ jruby --2.0 ../ruby/test/openssl/test_pkcs5.rb | |
Run options: | |
# Running tests: | |
...... |
#import <Foundation/Foundation.h> | |
NSString *collidingString() { | |
char rs[15]; | |
for (int i = 0; i < 14; i++) | |
rs[i] = arc4random_uniform('Z'-'A') + 'A'; | |
rs[14] = 0; | |
return [NSString stringWithFormat:@"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa%saaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa________________aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", | |
rs]; |
#!/usr/bin/env ruby | |
rss = '.+?Rss:\s+(\d+)' | |
share = '.+?Shared_Clean:\s+(\d+)' | |
share << '.+?Shared_Dirty:\s+(\d+)' | |
priv = '.+?Private_Clean:\s+(\d+)' | |
priv << '.+?Private_Dirty:\s+(\d+)' | |
MEM_REGEXP = /\[heap\]#{rss}#{share}#{priv}/m | |
def mem_usage() |
simple.rb
code = <<END
class Adder
def add_two(x)
x+2
end
end
# MRI 1.9.3 | |
system ~/projects/redblack $ rvm use ruby-1.9.3 | |
Using /Users/headius/.rvm/gems/ruby-1.9.3-p0 | |
ruby-1.9.3-p0 ~/projects/redblack $ ruby -I. bm1.rb 10 | |
3.275654 | |
GC.count = 7 | |
3.271799 | |
GC.count = 10 |
### | |
# Read in XML as a stream, write out JSON as a stream. As little information | |
# is kept in memory as possible. | |
require 'nokogiri' | |
require 'psych' | |
class JSONTranslator < Nokogiri::XML::SAX::Document | |
attr_reader :emitter | |
def initialize emitter |
require 'benchmark' | |
TIMES = 5000000 | |
Benchmark.bmbm(40) do |x| | |
x.report('hoge[:fuga] = foo') do | |
hoge = {} | |
foo = :foo | |
TIMES.times do | |
hoge[:fuga] = foo |
system ~/projects/jruby $ jruby --1.9 -rbenchmark -e "def foo(x, y, z); end; 5.times { puts Benchmark.measure { 1_000_000.times { foo(1, 2, 3) } } }" | |
0.117000 0.000000 0.117000 ( 0.117000) | |
0.092000 0.000000 0.092000 ( 0.092000) | |
0.089000 0.000000 0.089000 ( 0.089000) | |
0.090000 0.000000 0.090000 ( 0.090000) | |
0.089000 0.000000 0.089000 ( 0.089000) | |
system ~/projects/jruby $ jruby --1.9 -rbenchmark -e "def foo(x); end; 5.times { puts Benchmark.measure { 1_000_000.times { foo(a: 1, b: 2, c: 3) } } }" | |
0.385000 0.000000 0.385000 ( 0.385000) | |
0.357000 0.000000 0.357000 ( 0.357000) |
From the standpoint of OSSL (Ruby’s OpenSSL binding), 1.9.3 is a small release; bug fixes, performance improvements, official OpenSSL 1.0.0 support and a few API enhancements. We had a new digital time-stamp and ASN.1 Template(DSL) implementation presented by Martin Boßlet, but we could not merge those bleeding-edge new features into 1.9.3, since there's no Ruby developer who can review it. It was quite obvious for us to ask him to be a maintainer of OSSL, as an expert in crypto and network security.
Since then, he helped us to clean up lots of OSSL issues piled on our issue tracker, by fixing SEGV bugs, consulting with users, and tailoring the build system to fit OpenSSL versions/variants. Though he discreetly didn’t merge his new feature implementations into 1.9.3, it seems clear that you can utilize those at the next release.
OSSL is the best language binding implementation of OpenSSL in the way of offering most OpenSSL features through an easy API with some help from Ruby. Without Martin Boßlet's help,
# | |
# Get development tools installed | |
# | |
sudo yum install -y git cvs zlib-devel | |
sudo yum groupinstall -y "Development Tools" | |
# | |
# Install RVM | |
# | |
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm) |