Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6720161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:10:46+00:00 2026-05-26T09:10:46+00:00

I make a DLL-Java communication correspondingly this post . My compilation configuration you can

  • 0

I make a DLL-Java communication correspondingly this post. My compilation configuration you can see there:

    g++ -IC:\Users\RZ\Downloads\eigen-eigen-3.0.3\eigen-eigen-3.0.3 -IC:\Program Files\Java\jdk1.7.0\include\win32 -IC:\Program Files\Java\jdk1.7.0\include -O3 -msse -msse2 -mmmx -Wall -shared -c -o Vector3DImp.o ..\Vector3DImp.cpp
..\Vector3DImp.cpp:5:0: warning: "JNICALL" redefined
C:\Program Files\Java\jdk1.7.0\include\win32/jni_md.h:31:0: note: this is the location of the previous definition
g++ -Wl,--kill-at -shared -LC:\Program Files\Java\jdk1.7.0\lib -o Eigen.dll Vector3DImp.o

And then I write the same on Java. And launch a few tests with vector multiplication and vector addition: the result is:

Pure java 39 -38 ms

JNI Java 52 -50ms

Then I code the same test on C++ using the same code in DLL.
Result:

22 – 18 ms

Yeah the test strategy make seem rough, but the common result is sustainable.
Is there my fault or it is JNI drawback (I’m not good at it).

Note:

The main question is: Is it real the DLL use in Java is so hard (the performance reduces by 2.5 times). Why it is?

UPDATE:

At the request, there is source of test.
Sorry for mess there, it was made for my own need in short time.

My system configuration:
Windows 7 x32, Core 2 Duo.

Both Java and C++ projects were built in Eclipse IDEs with MingW Compiler for C++. For C++ vector calculation Eigen library was used. Also, I tried JBlas library, in the end of Java test it was awful, I don’t know why. Even with 3 multiplication operation (opposite 6 multiplication in cross product) the result was creepy. Look yourself.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:10:47+00:00Added an answer on May 26, 2026 at 9:10 am

    There are several factors that negatively impact the speed with JNI

    1. Data conversion between DLL and JVM. Your native DLL is little endian while JVM is a big endian so conversions are always performed. Sorry bu here is nothing left for improvement.

    2. The passing of JNIEnv is quite time consuming

    There are alternatives to JNI as JNA or CNI but do not expect massive improvements as the basic problem of passing data still remains. The major optimization here is to reduce either the number the calls to the native library or to pack parameters in a format that is friendly to both worlds.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is related to How to make consistent dll binaries across VS versions
How can I make a Property ReadOnly outside the Assembly (DLL) for people using
Is there a way to make a python module load a dll in my
I was wondering if there was a way to make a *.dll that mounts
Can you find out where System.loadLibrary() is finding a DLL from, with either Java
There is a lib sources for linux with make scripts. http://svn.gna.org/svn/pokersource/branches/poker-eval-java/ . I need
Can I make a DLL in VB.NET which I can use in VB.NET with
Microsoft.Z3.dll is described in the file properties as the Z3 Managed DLL. Java can
We have inherited VB6 dll which we need to make changes to. We have
I'm developing a DLL that uses WPF classes to make image manipulation. It works

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.