Project

java_bin

0.01
No commit activity in last 3 years
No release in over 3 years
Apache Solr JavaBin format (binary format) implementation for Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.7.5
>= 0.12.6
>= 2.4.2
>= 1.0.8
 Project Readme

java_bin¶ ↑

This is an Apache Solr JavaBin format (binary format) implementation for Ruby.

Features¶ ↑

  • fast parse(2.5 - 5 times faster than ruby eval), and less network traffic.

MRI 1.8.7
 [data2]
 ruby eval parse. 5000 times. elapsed time 6.664981
 javabin parse.   5000 times. elapsed time 1.472825
 4.52530409247534 times

REE 1.8.7
 [data2]
 ruby eval parse. 5000 times. elapsed time 4.844482
 javabin parse.   5000 times. elapsed time 1.059044
 4.57439162112245 times

YARV 1.9.2 pre1
 [data2]
 ruby eval parse. 5000 times. elapsed time 6.659331328
 javabin parse.   5000 times. elapsed time 1.261828473
 5.277525012704322 times
  • rsolr/solr-ruby support.

  • pure and c extension code.

  • ruby 1.8/1.9/2.0 support.

  • solr 1.4/3.1 support.

Requirements¶ ↑

  • Ruby1.8.7 or later (include 1.9.x, 2.0.x)

  • (recommended) C compiler (gcc or vc++): you can also use java_bin without c extension, but ‘pure’ is 30 times slower than ‘ext’.

  • JavaBin has been tested with MRI 1.8.7, REE 1.8.7, YARV 1.9.2, YARV 1.9.3 and 2.0.0 on CentOS6.3 (x86_64bit) with Apache Solr 1.4, 3.1

Install¶ ↑

(Linux)
gem sources -a http://gemcutter.org
gem install java_bin

(Windows)
fix (path to)\ruby\lib\ruby\1.8\i386-mswin32\config.h
  #if _MSC_VER != 1200
    ↓
  #if _MSC_VER < 1200

start => visual studio c++ 200x xxxx edition => visual studio tools => visual studio 200x command prompt
gem sources -a http://gemcutter.org
gem install java_bin
  or
cd (path to)\ext\java_bin\ext
ruby extconf.rb
nmake

Simple Usage¶ ↑

require 'rubygems'
require 'java_bin'

@parser = JavaBin.parser.new
result = @parser.parse( javabin format string )

With RSolr/Solr-Ruby¶ ↑

  • By RSolr/Solr-Ruby support, a parser automatically uses javabin format instead of ruby format.

require 'rubygems'
require 'rsolr'
require 'java_bin'

solr = RSolr.connect
solr.select :q => '*:*'

Valgrind/Memory Leaks¶ ↑

  • In this project we use Valgrind (www.valgrind.org) to ensure that the native extension is leak-free.

  • On any Debian-based Linux you simply need to install the valgrind package:

apt-get install valgrind
  • On homebrew-powered OSX, simply type:

brew install valgrind
  • Then invoke the Rake task. If any errors are present, it will fail.

rake valgrind

TODO¶ ↑

  • more parse speed

  • license

  • shared string over parsing

  • builder(writer)

References¶ ↑

Note on Patches/Pull Requests¶ ↑

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Author¶ ↑

Toshinori Kajihara <kennyj@gmail.com>

Copyright © 2010 - 2013 kennyj. See LICENSE for details.