gonzus / jnano

A Java binding for nanomsg
Other
54 stars 15 forks source link

Consider JNA instead of JNI? #2

Open jacek99 opened 11 years ago

jacek99 commented 11 years ago

Having to compile the JNI layer is a major deployment obstacle, especially for external customer sites (where often we do not even have proper permissions, etc).

Would you consider doing a JNA-based binding instead, maybe using their static binding to get JNI-level performance?

https://github.com/twall/jna

gonzus commented 11 years ago

Hi Jacek,

Yes, I would consider adding a JNA implementation / version of jnano, given how much simpler it is than JNI.

However, be advised of this: when I implemented the Crossroads Java binding, I did some performance tests comparing JNI and JNA, and the difference was very noticeable. Given that one of the goals of nanomsg is high performance (low latency, high throughput), it did not seem advisable to go the JNA route.

You should open up a discussion on the nanomsg mailing lists, to see what everyone else thinks about this.

Best regards,

Gonzalo Diethelm DCV Chile

From: Jacek Furmankiewicz [mailto:notifications@github.com] Sent: Thursday, September 19, 2013 8:05 PM To: gonzus/jnano Subject: [jnano] Consider JNA instead of JNI? (#2)

Having to compile the JNI layer is a major deployment obstacle, especially for external customer sites (where often we do not even have proper permissions, etc).

Would you consider doing a JNA-based binding instead, maybe using their static binding to get JNI-level performance?

https://github.com/twall/jna

— Reply to this email directly or view it on GitHubhttps://github.com/gonzus/jnano/issues/2.


Declaración de confidencialidad: Este Mensaje esta destinado para el uso de la o las personas o entidades a quien ha sido dirigido y puede contener información reservada y confidencial que no puede ser divulgada, difundida, ni aprovechada en forma alguna. El uso no autorizado de la información contenida en este correo podrá ser sancionado de conformidad con la ley chilena. Si usted ha recibido este correo electrónico por error, le pedimos eliminarlo junto con los archivos adjuntos y avisar inmediatamente al remitente, respondiendo este mensaje.

"Before printing this e-mail think if is really necesary". Disclosure: This Message is to be used by the individual, individuals or entities that it is addressed to and may include private and confidential information that may not be disclosed, made public nor used in any way at all. Unauthorized use of the information in this electronic mail message may be subject to the penalties set forth by Chilean law. If you have received this electronic mail message in error, we ask you to destroy the message and its attached file(s) and to immediately notify the sender by answering this message.

jacek99 commented 11 years ago

That would be a problem. In your JNA perf tests, were you using direct mapping?

https://github.com/twall/jna/blob/master/www/DirectMapping.md

I believe this is what they recommend in order to get perf approaching custom JNI.

Thank you for your efforts in bringing this interesting project to the Java ecosystem.

gonzus commented 10 years ago

I apologize for answering this after seven months! My fault, I am sorry.

I don't think I used direct mapping in my tests. It would be interesting if you could experiment a little and compare the current JNI-based binding with one or more JNA-based bindings.