Skip to content

Instantly share code, notes, and snippets.

@dnagir
dnagir / jruby-trinidad-non-threaded.sh
Created December 8, 2011 01:31
JRyby, MRI 1.9.3 and Rails 3.1 Benchmarks
FIRST REQUEST
Concurrency Level: 1
Time taken for tests: 0.670 seconds
Complete requests: 1
Failed requests: 0
Write errors: 0
Total transferred: 2956 bytes
HTML transferred: 2348 bytes
Requests per second: 1.49 [#/sec] (mean)
Time per request: 670.401 [ms] (mean)
@dnagir
dnagir / shell.sh
Created December 8, 2011 01:37
JRuby can't run on thin and can't install unicorn
RAILS_ENV=production thin start
The signal QUIT is in use by the JVM and will not work correctly on this platform
>> Using rack adapter
JopensslService.java:66 warning: already initialized constant PKCS1_PADDING
JopensslService.java:66 warning: already initialized constant SSLV23_PADDING
JopensslService.java:66 warning: already initialized constant NO_PADDING
JopensslService.java:66 warning: already initialized constant PKCS1_OAEP_PADDING
JopensslService.java:66 warning: already initialized constant UNIVERSAL_TAG_NAME
JopensslService.java:66 warning: already initialized constant EOC
JopensslService.java:66 warning: already initialized constant BOOLEAN
@dnagir
dnagir / Gemfile
Created December 9, 2011 09:11
devise-neo4j
source 'http://rubygems.org'
gem "neo4j", "~> 1.3.0"
gem "devise-neo4j"
@dnagir
dnagir / document.rb
Created December 12, 2011 05:25
Integrating neo4j with Dragonfly in Rails
class Document < Neo4j::Model
property :file_uid, :type => String
property :file_name, :type => String
file_accessor :file
end
@dnagir
dnagir / shell.sh
Created December 14, 2011 08:01
neo4j one spec is failing (locally only)
> bundle exec rake
/Users/dnagir/.rvm/rubies/jruby-1.6.5/bin/jruby -S bundle exec rcov -Ispec:lib --rails --include views -Ispec --exclude gems\/,spec\/,features\/,seeds\/ ./spec/event_handler_spec.rb ./spec/identity_map_spec.rb ./spec/load_spec.rb ./spec/neo4j_spec.rb ./spec/node_spec.rb ./spec/paginate_spec.rb ./spec/relationship_set_spec.rb ./spec/relationship_spec.rb ./spec/transaction_spec.rb ./spec/algo/graph_algo_spec.rb ./spec/batch/indexer_spec.rb ./spec/batch/inserter_spec.rb ./spec/batch/lucene_inserter_spec.rb ./spec/batch/rule_inserter_spec.rb ./spec/cypher/cypher_spec.rb ./spec/has_list/timeline_spec.rb ./spec/has_n/has_n_spec.rb ./spec/has_n/has_one_spec.rb ./spec/index/index_spec.rb ./spec/index/shared_index_spec.rb ./spec/migrations/global_migration_spec.rb ./spec/migrations/lazy_node_mixin_spec.rb ./spec/migrations/node_mixin_spec.rb ./spec/node_mixin/node_mixin_find_spec.rb ./spec/node_mixin/node_mixin_spec.rb ./spec/orm_adapter/adapters/neo4j_spec.rb ./spec/property/property_spec.rb ./spec
@dnagir
dnagir / terminal.sh
Created January 4, 2012 06:47
Profiling RSpec-s with JRuby
> bundle install --binstubs
> jruby --profile bin/rspec spec/
........ etc .....
Finished in 56.58 seconds
204 examples, 0 failures, 59 pending
main thread profile results:
Total time: 60.30
@dnagir
dnagir / -X+C
Created January 7, 2012 03:12
Updating RSpec breaks JRuby
CachingCallSite.java:418:in `pollAndGetClass': java.lang.NullPointerException
from CachingCallSite.java:164:in `call'
from /Users/dnagir/.rvm/gems/jruby-1.6.5.1/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:193:in `method__9$RUBY$initialize'
from Users$dnagir$$_dot_rvm$gems$jruby_minus_1_dot_6_dot_5_dot_1$gems$rspec_minus_core_minus_2_dot_8_dot_0$lib$rspec$core$configuration$method__9$RUBY$initialize:65535:in `call'
from CachingCallSite.java:302:in `cacheAndCall'
from CachingCallSite.java:144:in `callBlock'
from CachingCallSite.java:148:in `call'
from RubyClass.java:806:in `newInstance'
from RubyClass$i$newInstance.gen:65535:in `call'
from JavaMethod.java:249:in `call'
@dnagir
dnagir / terminal.sh
Created January 9, 2012 05:52
JRuby --server & MRI call vs send
> sh run.sh
======================== JRUBY =========================
Using /Users/dnagir/.rvm/gems/jruby-1.6.5.1
jruby 1.6.5.1 (ruby-1.9.2-p136) (2011-12-27 1bf37c2) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]
Benchmark for 100000 iterations
user system total real
send 0.266000 0.000000 0.266000 ( 0.266000)
call 0.069000 0.000000 0.069000 ( 0.069000)
Benchmark for 1000000 iterations
user system total real
@dnagir
dnagir / run.sh
Created January 9, 2012 05:19
JRuby & MRI call vs send
#!/bin/sh
source ~/.bash_profile
echo "======================== JRUBY ========================="
rvm use jruby &&
ruby -v &&
TIMES=100_000 ruby test.rb
TIMES=1000_000 ruby test.rb
@dnagir
dnagir / terminal.sh
Created January 9, 2012 07:42
JRuby 1.7.dev bundle install issue
> bundle
Fetching source index for http://rubygems.org/
Using rake (0.9.2.2)
Using multi_json (1.0.4)
Using activesupport (3.1.3)
Using builder (3.0.0)
Using i18n (0.6.0)
Using activemodel (3.1.3)
Using erubis (2.7.0)
Using rack (1.3.5)