Skip to content

Instantly share code, notes, and snippets.

View charliedavi's full-sized avatar

Charlie Davies charliedavi

View GitHub Profile
14:52:06,127 INFO [org.jboss.as.osgi] (MSC service thread 1-6) JBAS011942: Stopping OSGi Framework
14:52:06,125 INFO [org.jboss.as.messaging] (MSC service thread 1-3) JBAS011605: Unbound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory
14:52:08,914 INFO [org.jboss.as.configadmin] (ServerService Thread Pool -- 42) JBAS016200: Activating ConfigAdmin Subsystem
14:52:08,923 INFO [org.jboss.as.remoting] (MSC service thread 1-8) JBAS017100: Listening on /127.0.0.1:9999
14:52:08,939 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 47) JBAS010280: Activating Infinispan subsystem.
14:52:08,952 INFO [org.jboss.as.jacorb] (ServerService Thread Pool -- 48) JBAS016300: Activating JacORB Subsystem
14:52:09,019 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 58) JBAS011800: Activating Naming Subsystem
14:52:09,048 INFO [org.jboss.as.osgi] (ServerService Thread Pool -- 59) JBAS011940: Activating OSGi Subsystem
14:52:09,062 INFO [org.jboss.as.connector.subs
require 'java'
require 'libssrckdtree-j-1.0.2.jar'
def rand_coord
rand(0) * 10 - 5
end
@kdsize = 1000
@points = (0...1000).map { |i| [rand_coord, rand_coord, i ] }
Firstly I know that having a C extension in JRUBY is not a great idea, however, I am kind of being forced in a way.
I have a system at the moment that uses a Ruby KDTree https://github.com/MagLev/maglev/tree/master/examples/persistence/kdtree/
It works, but its not very quick. I am using Jruby because of its great performance and would love to stay with it.
To improve the speed of the KDTree, I found and used https://github.com/consti/tupalo-kdtree which is crazy quick, it also has the same syntax for use http://rubydoc.info/gems/tupalo-kdtree/0.2.3/frames and it works great under MRI 1.9.3 - it brings down on benchmark from 30 seconds to around 0.01 seconds.
However when I try and load this gem in Jruby it only works to load using JRUBY_OPTS=--1.8 - which is odd, but it loads find and installs.
charlie@Charlie-Vostro ~/tech/dev/lab/kdtree $ gem install tupalo-kdtree
Building native extensions. This could take a while...
Successfully installed tupalo-kdtree-0.2.3
1 gem installed
charlie@Charlie-Vostro ~/tech/dev/lab/kdtree $ ruby newtest.rb
LoadError: no such file to load -- kdtree
require at org/jruby/RubyKernel.java:1033
require at /home/charlie/.rvm/rubies/jruby-1.6.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36
(root) at newtest.rb:2
charlie@Charlie-Vostro ~/tech/dev/lab/kdtree $
JAVA_OPTS already set in environment; overriding default settings with values: -XX:MaxPermSize=2000m -Xmx4000m
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /home/charlie/tech/server/torquebox-current/jboss
JAVA: java
JAVA_OPTS: -server -XX:+UseCompressedOops -XX:+TieredCompilation -XX:MaxPermSize=2000m -Xmx4000m
class PostCodeGo
class << self
include TorqueBox::Messaging::Backgroundable
always_background :postcode, :priority => :normal
def postcode(time, origin, mode, email)
iso = Real::Chrone.new_or_cached(time: time, origin: origin, mode: mode.to_sym)
csvs = [iso.postcode_csv, iso.postcode_sector_csv, iso.postcode_district_csv]
source 'http://rubygems.org'
gem 'rails', '3.1.0'
gem 'rake'
# Asset template engines
gem 'sass'
gem 'coffee-script'
gem 'uglifier'
gem 'jquery-rails'
gem 'rails-backbone'
(in /home/charlie/dev/igeolise-api)
/home/charlie/.rvm/gems/jruby-1.6.5.1@global/gems/bundler-1.0.21/lib/bundler/rubygems_integration.rb:161 warning: already initialized constant Deprecate
/home/charlie/.rvm/gems/jruby-1.6.5.1@global/gems/bundler-1.0.21/lib/bundler/rubygems_ext.rb:151 warning: already initialized constant JAVA
/home/charlie/.rvm/gems/jruby-1.6.5.1@global/gems/bundler-1.0.21/lib/bundler/rubygems_ext.rb:152 warning: already initialized constant MSWIN
/home/charlie/.rvm/gems/jruby-1.6.5.1@global/gems/bundler-1.0.21/lib/bundler/rubygems_ext.rb:153 warning: already initialized constant MINGW
/home/charlie/.rvm/gems/jruby-1.6.5.1@global/gems/bundler-1.0.21/lib/bundler/rubygems_ext.rb:202 warning: already initialized constant GENERIC_CACHE
/home/charlie/.rvm/gems/jruby-1.6.5.1@global/gems/bundler-1.0.21/lib/bundler/rubygems_ext.rb:203 warning: already initialized constant GENERICS
/home/charlie/.rvm/gems/jruby-1.6.5.1@global/gems/bundler-1.0.21/lib/bundler.rb:17 warning: already initialized constant
** [10:42:52 2012-01-23] 6518: resque-1.19.0: Processing email since 1327315372
rake aborted!
Java heap space
java.util.Arrays.copyOf(Arrays.java:2894)
java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:117)
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:407)
java.lang.StringBuilder.append(StringBuilder.java:136)
org.jruby.RubyBasicObject.inspectObj(RubyBasicObject.java:1108)
org.jruby.RubyBasicObject.hashyInspect(RubyBasicObject.java:1080)
org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1059)
IgeoliseApi::Application.routes.draw do
# The priority is based upon order of creation:
# first created -> highest priority.
resources :iterations
resource :time_filter do
post :email_csv, on: :collection
end
resource :route_tree do
post :email_csvs, on: :collection