Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

faster interaction with C code? #74

Open
Mis012 opened this issue Jan 22, 2021 · 1 comment
Open

faster interaction with C code? #74

Mis012 opened this issue Jan 22, 2021 · 1 comment

Comments

@Mis012
Copy link

Mis012 commented Jan 22, 2021

Hi,
does this eliminate the performance penalty for JNI calls?
(since you're not jumping into / out of a VM)
if not, does this enable a different option for implementing Java APIs in C?

@dz333
Copy link
Collaborator

dz333 commented Jan 22, 2021

Hi, great question!

We haven't evaluated native method call performance specifically compared to standard JVM implementations, although
I think we likely do better there.

At the moment there is some overhead because we execute a dynamic native method call lookup, which I'm not sure that we can eliminate. The Java native API allows you to dynamically register native methods signatures to native implementations at runtime (and change these bindings), so our implementation stores signature to native function bindings. Invoking a native method involves a lookup in this map and then jumping to the linked native code. If it's not found in the map then we attempt to invoke the method as a system DLL.

There may be optimizations that allow us to remove this dynamic lookup for certain invocations and statically link the native code, but I am not certain and haven't looked into it in any detail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants