Does Java allow for creating byte arrays (each element is a single
8-bit addressable element)?
If so, can JRuby create and access them like regular Ruby class Array
objects? (Ex: myarray = BArray.new; 10.times {|i| myarray << i}
Is there an existing Java/JRuby library/gem that provides this for
JRuby?
I’m doing numerical processing where I really need boolean arrays (an
array of bits), but since most cpus are byte addressable I guess the
best I can get, and still perform as regular Ruby arrays, is byte
addressable arrays.
If so, can JRuby create and access them like regular Ruby class Array
objects? (Ex: myarray = BArray.new; 10.times {|i| myarray << i}
Can’t you just create a normal Ruby array, make sure that you stuff into
it java.lang.Byte objects, and when you finally need it on the Java
side, apply the ‘to_java’ method on it?
I am not a Java programmer (have done no “real” Java program) so I know
virtually nothing of manipulating the language.
I’ll look at the links you supplied and see if they help me.
I’m trying to extend usable memory when running the same gem in MRI vs
JRuby. JRuby runs out of memory much faster on my apps than MRI does on
certain use cases, making it more of a niche language for me than a
general go to Ruby implementation.
I don’t quite see, how working with byte arrays might help you. If I
remember right, there is an option when starting Java, where you set the
maximum memory to be used. If you don’t find it in the Java docs, I
suggest you ask this in a Java forum.