The current implementation of BCrypt.java is written as a "normal" Java library that is then integrated into JRuby using our Java Integration subsystem.
While this is a simple way to implement the library and call it, it introduces a lot of overhead due to the nature of this cross-language boundary:
- Ruby objects must be converted into appropriate types for the Java methods.
- Java results must be converted back into Ruby objects.
- Some amount of reflection overhead (perhaps eliminated by JRuby's JIT).
I believe the library could be much more efficient if moved to using JRuby's extension API.
The current implementation of BCrypt.java is written as a "normal" Java library that is then integrated into JRuby using our Java Integration subsystem.
While this is a simple way to implement the library and call it, it introduces a lot of overhead due to the nature of this cross-language boundary:
I believe the library could be much more efficient if moved to using JRuby's extension API.