Prev: How to get an include-path of jni.h that is able to be differenton different platforms.
Next: Read utf-8 file return utf-16 coding hex string ?
From: Sanny on 29 Jan 2010 02:53 I have a Java Applet which is quite slow. There are a few functions that are called by the Java Applet. I want those functions to be run as fast as possible. One Option is to use Native Support. Does an Applet support native language? Can I create a C++ / C function and ask the applet to call that C function that is run on Users Computer? And get back the output and display on the Applet? I just want a few functions to use fast C/ C++ access? How to distribute my applet with C/ C++ dll/ That Applet accesses? I will have 2 versions of Applet. One the slow version the other the fast version. I want that users who are not satisfied with the slow version. They will need to use the Signed Applet. Once they allow the Signed applet to access the Computer. The applet will load the C/ C++ dll / ActiveX on the Computer / Webpage. I want communication between Activex and the Applet for quick computation. Will the Activex/ DLL be 10-20 times faster than an Applet? So for power users who are looking for better performance I allow them to use the C/ C++ version. Will this model work? Will I have to create different ddl/ ActiveX for different platforms? Say for Mac os/ Linux/ Windows etc? Do I need to create a different ActiveX? I just have a few functions in C/ C++ and the Applets sends the parameters and returns the output. Which C/C++ free package should I use to create this function. I just want a few functions to be executed quickly by native language and return the output to the applet. So I want a free editor where I can compile the C/ C++ functions. Second Question Will an Activex/ DLL on a webpage be as fast as any executable? I am looking for the fastest options. Please suggest me a good example or diagram of how to proceed. Will I need Corba/ XML feature for Applet & Activex communication? Will this setup work on all web browsers? Does flash works faster than Java? Can I use those functions in Flash. Wil a function run on Flash as fast as a Native Language? Bye Sanny Good opportunities for Java/ C/ C++ Experts: http://www.getclub.com/Experts.php Tell your Expertise and projects.
From: Nick Keighley on 29 Jan 2010 03:01 On 29 Jan, 07:53, Sanny <softtank...(a)hotmail.com> wrote: > I have a Java Applet which is quite slow. > > There are a few functions that are called by the Java Applet. I want > those functions to be run as fast as possible. > > One Option is to use Native Support. > > Does an Applet support native language? > > Can I create a C++ / C function and ask the applet to call that C > function that is run on Users Computer? And get back the output and > display on the Applet? this isn't on topic on comp.lang.c how C or C++ "links" with java is outside the scope of the C or C++ language. <snip>
From: Peter Duniho on 29 Jan 2010 03:08 (newsgroups fixed�this doesn't have anything to do with C) Sanny wrote: > I have a Java Applet which is quite slow. > > There are a few functions that are called by the Java Applet. I want > those functions to be run as fast as possible. You should probably fix your Java code then. It's rare for Java performance to be so critical that you need to go outside of Java. And you almost certainly won't get the 10x or 20x speedup you seem to be hoping for. > One Option is to use Native Support. You can easily make things slower, if you do that wrong. And it won't necessarily be faster in any case. IMHO JNI is more appropriate for when you need some specific functionality that's simply not available in Java, or you need to reuse some code that would be impractical to port to Java. No doubt there are some specific, very specialized applications in which writing some custom native code and calling it via JNI is helpful. But statistically speaking, it's not likely your program is in that category. > Does an Applet support native language? > > Can I create a C++ / C function and ask the applet to call that C > function that is run on Users Computer? And get back the output and > display on the Applet? Unfortunately, I don't know much about applets. But due to security concerns, I would expect applets to have much more restricted access to JNI than regular Java applications. But, I suspect you don't really need to use JNI. > [...] > Will I have to create different ddl/ ActiveX for different platforms? > > Say for Mac os/ Linux/ Windows etc? Do I need to create a different > ActiveX? ActiveX is Windows-only. Each platform has its own library format and supported CPUs. If you want a platform-specific solution, just write the whole thing as native code. If you want cross-platform support, write the whole thing in Java, figure out why your program is so slow, and fix it using only Java. Pete
From: Flash Gordon on 29 Jan 2010 03:24 Sanny wrote: <snip> > Say for Mac os/ Linux/ Windows etc? Do I need to create a different > ActiveX? This is about the nearest thing to a C question, and even this is not a C question... Of course any compiled C code would have to be compiled for the specific target it is running on... <snip> > Does flash works faster than Java? Can I use those functions in Flash. > Wil a function run on Flash as fast as a Native Language? You probably need to ask in a web authoring group/forum, since your problems are all heavily to do with a web site. However, I would recommend from my experience that you would be better off looking at a higher level, ensuring that only what is needed is being downloaded etc. I've seen sites where as much as 90% of what was downloaded was not actually needed by the client! How to do this is all about web authoring, and not Java (which is NOT Javascript) or C. -- Flash Gordon
From: Sanny on 29 Jan 2010 06:33
> Sanny wrote: > > I have a Java Applet which is quite slow. > > > There are a few functions that are called by the Java Applet. I want > > those functions to be run as fast as possible. > > You should probably fix your Java code then. It's rare for Java > performance to be so critical that you need to go outside of Java. And > you almost certainly won't get the 10x or 20x speedup you seem to be > hoping for. There is nothing wrong with the java code. I know some expressions in C are working 10-20 times faster. Secondly "C" allows the use of pointers and Assembly language programming. Also I can configure Compilation in "C" such that it do not do error checking at runtime speeding it up further. My program does a lot of array sorting and array search and comparisions. That is quite faster in C. Also lot of String Operation is done. In Java String Operations are 100 times slower than in "C". As copying a string takes lots of time in Java. > > One Option is to use Native Support. > > You can easily make things slower, if you do that wrong. And it won't > necessarily be faster in any case. IMHO JNI is more appropriate for > when you need some specific functionality that's simply not available in > Java, or you need to reuse some code that would be impractical to port > to Java. > > No doubt there are some specific, very specialized applications in which > writing some custom native code and calling it via JNI is helpful. But > statistically speaking, it's not likely your program is in that category. One more reasion to use "C" is to have my code encrypted. Java Code is available to all so others can easily hack the java code. While cracking an Activex is I suppose impossible. > > Does an Applet support native language? > > > Can I create a C++ / C function and ask the applet to call that C > > function that is run on Users Computer? And get back the output and > > display on the Applet? > > Unfortunately, I don't know much about applets. But due to security > concerns, I would expect applets to have much more restricted access to > JNI than regular Java applications. I have full understanding of these. Only problem is how Browser accepts the Activex and Applet. Will a firefox browser run an ActiveX on Non Windows OS? > But, I suspect you don't really need to use JNI. > > > [...] > > Will I have to create different ddl/ ActiveX for different platforms? > > > Say for Mac os/ Linux/ Windows etc? Do I need to create a different > > ActiveX? > > ActiveX is Windows-only. Each platform has its own library format and > supported CPUs. If you want a platform-specific solution, just write > the whole thing as native code. OK, I can ask the users to purchase Windows operating System if they want faster version. Thats not a big problem. I suppose 80-90% will already have a windows version. > If you want cross-platform support, write the whole thing in Java, > figure out why your program is so slow, and fix it using only Java. Its not Slow exactly. But I want it to be more fast. As C/ C++ routines are much faster as I can use Assembly language programming. Bye Sanny Good opportunities for Java/ C/ C++ Experts: http://www.getclub.com/Experts.php Tell your Expertise and projects. |