Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling C or C++ methods from Java

 
prabal nandi
Greenhorn
Posts: 28
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if i make a java application running on a server, which is calling C or C++ methods having all the busniess logic, will that make my application faster compared to a normal java application.
 
Paul Clapham
Sheriff
Posts: 20711
29
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a portlets question. Moving.
 
prabal nandi
Greenhorn
Posts: 28
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JavaRanch » Java Forums » Java » Performance
 
prabal nandi
Greenhorn
Posts: 28
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry i guess this post got posted twice.. "JavaRanch » Java Forums » Java » Performance ". this will be the correct path.
but can somebody seriously help me out and can also provide a proper explaination.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13055
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Creating and calling the interface to JNI methods certainly will consume some CPU time so your C or C++ would have to be faster to justify that.

If multiple clients can access the application, you would have to manage the separate requests. If database access is involved in the business logic that CPU time would probably be much more important than execution of logic code so the language won't matter.

Bill
 
Paul Clapham
Sheriff
Posts: 20711
29
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That might make your code faster. But it would have to make it a whole lot faster before it was worth doing, if you're talking about a server application.
 
Chris Hurst
Ranch Hand
Posts: 443
3
C++ Eclipse IDE Java
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are lots of good reasons to call c++ from java and business logic isn't one of them generally.

JNI has an over head and unoptimised C++ can run slower than Java, Javas is not that slow any more check out some benchmarks on the web before proceeding.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic