Speed of C/ASM over Java

Discussion in 'OT Technology' started by CompiledMonkey, Jun 4, 2003.

  1. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
    I'm looking into some possible work and extensive algorithms would be needed. Speed and scalability are probably the most important factors in this. Would using JNI in Java to call C/ASM code be worth any overhead? Is there any overhead in using JNI? Has anyone done this before?
     
  2. crotchfruit

    crotchfruit Guest

    i tried to use JNI once a billion years ago, and found the interface to be horribly complicated and stupid, and any effort used to learn it would be better suited killing myself. maybe they've changed it since then..

    which part of java is necessary for your application that makes you have to use it in the first place? maybe you can figure out c/c++ alternatives and make your whole app in c/c++?
     
  3. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
    Well, a group at school is looking at doing a search engine. Our University is centered around Java, so everybody knows it really well already. I just don't know if Java is fast enough to run these algorithms. :dunno:
     
  4. R-Type

    R-Type The Bydo Empire must die!

    Joined:
    Aug 2, 2002
    Messages:
    1,049
    Likes Received:
    0
    Location:
    CT
    For a search engine it would depend on what part of it you're talking about. I suppose the higher level components could be done feasibly in java while still maintaining decent performance. In this case maybe you'd make SQL calls to some already existing database server(s). However, if you have to implement the database engine from scratch as well, that part should be done in C/C++. Think how much CPU power huge database servers need as it is. Why would you want to add all that abstraction that would do nothing but slow it down even more and make the whole project potentially more buggy?

    Frankly, I'm not really sure why universities all over the place are focusing so much on any one language (right now it seems to be java and VB *ugh*). I guess they aren't proponents of "The right tool for the right job."
     
  5. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
    I wouldn't consider calling a method or two from a C source file that much abstraction.

    When you're learning, focusing on one language is best. Why would they want to confuse people with 3 or 4 different languages from day one?
     
  6. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    Depends on the OS and the DBMS.

    If its MySQL, you'll probably find the best query performance is with MySQL on Linux using C/C++ as the interface.

    Assembler is not built for this task (think of Assembler being used for talking to the hardware).
     
  7. CompiledMonkey

    CompiledMonkey New Member

    Joined:
    Oct 26, 2001
    Messages:
    8,528
    Likes Received:
    0
    Location:
    Richmond, VA
    We'd be using RH or Solaris 9 with Oracle.
     
  8. Astro

    Astro Code Monkey

    Joined:
    Mar 18, 2000
    Messages:
    2,047
    Likes Received:
    0
    Location:
    Cleveland Ohio
    You'd probably have much better performance with Solaris if you guys can swing it - at least if you have multiple processors.
     
  9. R-Type

    R-Type The Bydo Empire must die!

    Joined:
    Aug 2, 2002
    Messages:
    1,049
    Likes Received:
    0
    Location:
    CT
    Well I was going on the assumption based on your wording that you'd be writing the whole thing in native java, not just using it to make calls to C coded subroutines...(I assume this is what JNI is? I'm not that familiar with java nomenclature) But if 90% of the codebase you're calling to is C based anyway, why not just use a script language like perl or php to write your front end and bag the java bloat?

    Yes, its good to start with one language to teach programming basics. however, I know several college graduates who only know one high level language. I was in one of the last classes to actually have a comp/sci program that had a few classes in C, C++ (and even one in x86 ASM) in addition to higher level lang courses in VB(ugh). I realize high level languages are what's hot these days, but I think without even a little experience with something like C or ASM (for any arch) limits a programmer's ability to see how a computer really works. I've seen professional programmers at work (as well as most of the comp/sci students I knew at college) who couldn't understand their computer outside the 'bubble' of their IDE. It was quite surprising to me. Also quite sad :\.
     

Share This Page