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
require 'stringio' | |
require 'base64' | |
def read_varint(io) | |
value = index = 0 | |
begin | |
byte = io.readchar | |
value |= (byte & 0x7f) << (7 * index) | |
index += 1 | |
end while (byte & 0x80).nonzero? |
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
~/projects/jrubies ➔ ls | |
jruby-0.5.2 jruby-0.8.1 jruby-0.9.1 jruby-0_3_0 jruby-1.0 jruby-1.1 jruby-1.1.4 jruby-1.3.0 jruby-1.5.0 jruby-1.5.4 jruby-1.6.0.RC2 | |
jruby-0.5.3 jruby-0.8.2 jruby-0.9.8 jruby-0_3_1 jruby-1.0.1 jruby-1.1.1 jruby-1.1.5 jruby-1.3.1 jruby-1.5.1 jruby-1.5.5 jruby_0_2_0 | |
jruby-0.7.0 jruby-0.8.3 jruby-0.9.9 jruby-0_5_0 jruby-1.0.2 jruby-1.1.2 jruby-1.1.6 jruby-1.4.0 jruby-1.5.2 jruby-1.5.6 jruby_0_2_1 | |
jruby-0.8.0 jruby-0.9.0 jruby-0_2_4 jruby-0_5_1 jruby-1.0.3 jruby-1.1.3 jruby-1.2.0 jruby-1.4.1 jruby-1.5.3 jruby-1.6.0.RC1 jruby_0_2_2 | |
~/projects/jrubies ➔ time java -jar jruby_0_2_0/jruby.jar -e "def fib(a); a < 2 ? a : fib(a - 1) + fib(a - 2); end; 10.times { fib(30) }" | |
real 0m52.106s | |
user 0m49.630s |
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
~/projects/jcd ➔ ab -n 1000 -d -S http://localhost:3000/ | |
This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking localhost (be patient) | |
Completed 100 requests | |
Completed 200 requests | |
Completed 300 requests | |
Completed 400 requests |
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
~/projects/jruby ➔ jruby memory_mapped.rb | |
Reading and writing memory-mapped | |
2.355000 0.000000 2.355000 ( 2.299000) | |
1.943000 0.000000 1.943000 ( 1.942000) | |
2.014000 0.000000 2.014000 ( 2.014000) | |
1.899000 0.000000 1.899000 ( 1.899000) | |
1.870000 0.000000 1.870000 ( 1.870000) | |
Reading from disk | |
2.982000 0.000000 2.982000 ( 2.982000) | |
3.031000 0.000000 3.031000 ( 3.031000) |
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
~/projects/jruby ➔ ls lib/ruby/gems/1.8/gems/ | wc -l | |
471 | |
~/projects/jruby ➔ time jruby -rubygems -e 1 | |
real 0m5.079s | |
user 0m7.375s | |
sys 0m0.393s | |
~/projects/jruby ➔ git stash pop --quiet |
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
#!/usr/bin/env ruby | |
=begin | |
INSTALL: | |
curl http://github.com/defunkt/gist/raw/master/gist.rb > gist && | |
chmod 755 gist && | |
sudo mv gist /usr/local/bin/gist |
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
#!/bin/bash | |
# | |
# Provides a function that allows you to choose a JDK. Just set the environment | |
# variable JDKS_ROOT to the directory containing multiple versions of the JDK | |
# and the function will prompt you to select one. JAVA_HOME and PATH will be cleaned | |
# up and set appropriately. | |
# Usage: | |
# Include in .profile or .bashrc or source at login to get 'pickjdk' command. | |
# 'pickjdk' alone to bring up a menu of installed JDKs on OS X. Select one. |
NewerOlder