LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-06-2008, 02:09 PM   #1
airswit
Member
 
Registered: Dec 2005
Distribution: Fedora 4
Posts: 89

Rep: Reputation: 15
java compiler?


Hi All,

i am trying to compile a java app (hoping it will run faster), but i am running into a problem. I am trying to compile with gcj (gcc v3.4.4), but my app was built with java v1.6.

a couple questions:
1. is there an easier compiler to use/install for redhat (work computer)
2. how can i install a second version of gcc/gcj (newest release), without overwriting the original (i can't, anyway)
3. can/should i use the -target 1.x option for my app build, and if so, does anyone know what version i should use to work with my version of gcj/gcc?

any help appreciated

-Trevor
 
Old 04-06-2008, 02:38 PM   #2
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 70
Quote:
Originally Posted by airswit View Post
Hi All,

i am trying to compile a java app (hoping it will run faster), but i am running into a problem. I am trying to compile with gcj (gcc v3.4.4), but my app was built with java v1.6.
I think, it would be much better for you to just download and install Sun's JDK from their site. http://developers.sun.com/downloads/
 
Old 04-06-2008, 02:42 PM   #3
airswit
Member
 
Registered: Dec 2005
Distribution: Fedora 4
Posts: 89

Original Poster
Rep: Reputation: 15
does it include an ahead-of-time compiler?
 
Old 04-06-2008, 05:14 PM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,783

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
It doesn't and I doubt it is in the Java community agenda to work in that direction.

Focusing on understanding why your program doesn't perform as well as you expect and improving it where it needs to be might be more productive than trying to run it under gcj. There is no strong evidence that a gcj compiled applications will run significantly faster (if faster at all) than the same one under recent JVMs.
 
Old 04-06-2008, 09:58 PM   #5
airswit
Member
 
Registered: Dec 2005
Distribution: Fedora 4
Posts: 89

Original Poster
Rep: Reputation: 15
well, this application analyzes on the order of millions of lines of data each time it updates it's information. i need any speedup i can get (the interface is not the slow part, it is the updating of state information that the app tracks).

also, before i got my hands on this project, it was running of of swap space (holding on to maybe 20k records, each having ~10 strings in them), and i had to get around that by putting a limit on the amount of data that i could track.
 
Old 04-07-2008, 03:44 AM   #6
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,783

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
According to your description, there would be no significant advantage in ahead of time compiling. The JIT compiling time being peanuts compared to execution time.

Garbage collecting algorithms and heap sizing might make a difference. You may consider using a 64 bit JVM too.
 
Old 04-07-2008, 06:37 PM   #7
airswit
Member
 
Registered: Dec 2005
Distribution: Fedora 4
Posts: 89

Original Poster
Rep: Reputation: 15
i didn't realize that the 'java' app was a jit compiler. i thought it was an interpreter.

could you tell me how to increase the heap size? is this a compile-time option or a runtime option?
 
Old 04-07-2008, 07:24 PM   #8
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,783

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
These are runtime options.

Try "java -Xint ..." and feel what pure interpretation performance looks like ...

To set the heap size:

-Xms<size> set initial Java heap size
-Xmx<size> set maximum Java heap size

eg. "java -Xms1g -Xmx1g ..."
 
Old 04-07-2008, 07:35 PM   #9
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
You also might want to look at Sun's Tuning Whitepaper for it's JVM.

Last edited by jtshaw; 04-08-2008 at 07:13 AM. Reason: Should have read JVM, not SDK...
 
Old 04-07-2008, 09:56 PM   #10
airswit
Member
 
Registered: Dec 2005
Distribution: Fedora 4
Posts: 89

Original Poster
Rep: Reputation: 15
thanks for the tips. i guess the book i read is a bit out of date (circa '99, i think), and it implied that the basic running of a java app was using interpreted, not a jit.

for reference (and to get an idea on what i might increase my heap size to be), is there any way to find out what the default heap size is?

-Thanks
 
Old 04-08-2008, 03:09 AM   #11
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,783

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
The default maximum heap size is 64M.
 
Old 04-08-2008, 07:11 AM   #12
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
Quote:
Originally Posted by airswit View Post
thanks for the tips. i guess the book i read is a bit out of date (circa '99, i think), and it implied that the basic running of a java app was using interpreted, not a jit.
I might be a little fuzzy on the details... but I believe the way it worked in its original implementation was the java "compiler" compiled into byte code (the platform independent stuff) that was interpreted by the JVM. Overtime they went to just-in-time compilation of the byte code into native code which dramatically increased speed. Now days I believe they have gone even further with some implementations and the JVM uses dynamic recompilation to optimize the program as it sees fit during runtime. In the end game, you can actually end up with a program that runs faster/more efficient then statically compiled code.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
java compiler asilentmurmur SUSE / openSUSE 5 08-14-2005 11:55 PM
Java 1.5 Compiler KissDaFeetOfSean Linux - Newbie 5 07-10-2005 10:45 PM
Java c compiler corbis_demon Linux - Newbie 2 08-11-2004 11:14 PM
java compiler athenerx Programming 33 06-30-2004 04:21 PM
java compiler shamz Programming 2 10-26-2003 05:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration