Re: [Java] Function binding
John Moeller <[email protected]>
| Newsgroups | gmane.comp.lib.boost.langbinding |
|---|---|
| Message-ID | <[email protected]> |
David Abrahams wrote: > on Tue Jul 03 2007, John Moeller <fishcorn-AT-gmail.com> wrote: >>> If necessary, You can use the same backend interface that will be used >>> by the dynamic languages to generate C++ code that will be compiled in >>> a separate phase. However it sounds like Rene has a slicker option. >>> I guess if Rene's approach is too slow, both options can be made >>> available. >> That's an approach I thought of as well, but I was hoping to avoid it. >> I like Rene's approach better; though it could have some overhead. What >> I worry about is the "unboxing" of primitive arguments (int, double, >> etc.). It's generally an unnoticable overhead (if any) to call a native >> function, but it can get hefty to go in reverse. > > You know lots more about the Java issues than I do... but wouldn't > that issue of going in reverse apply no matter what technique we use? In the case where you generate code for C++, you could create direct bindings for the Java native methods. Which means that it's possible to design an interface that only calls from Java. I'm also getting ahead of myself. I'd really need to measure before I could say for sure that there would be a performance hit. The classic wisdom is that making JVM calls is slower than making native calls, but that wisdom was born years ago, and a lot has changed since then. Regardless, I'll make sure that we have a proper apples-to-apples test against a "normal" use of calls across the JNI boundary. My colleagues at work occasionally refer to "the cost of a native call," which makes me bristle. -- John Moeller [email protected] ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/