public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "netzberg at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug java/23283] New: Java interpreter significantly faster than gcc?!
Date: Mon, 08 Aug 2005 10:04:00 -0000	[thread overview]
Message-ID: <20050808100453.23283.netzberg@gmail.com> (raw)

I have a very compact code example (10 lines) for which running java interpreter
on a class file takes 4.5s and executing optimized binary created from the class
file with gcj takes 5.5s. Something is funny here. Can anyone explain what's
happening?

% uname -a
Linux localdomain 2.6.12-1.1372_FC3 #1 Fri Jul 15 00:59:10 EDT 2005 i686 i686
i386 GNU/Linux

>>>>>>>>>>> The java code (X.java):
import java.lang.*;
import java.util.*;
import java.io.*;
public class X {
    public static void main(String[] args) {
	Random R = new Random();
	for (int i=0; i < 10000000; i++)
	    R.nextDouble();
    }
}
>>>>>>>>>>The Makefile
all:
	@javac X.java
	@echo "*** Interpreted:"
	@time java -classpath . X
	@gcj -O3 --main=X -o x X.java
	@echo "*** Compiled:"
	@time ./x
>>>>>>>>>>Here is the output:
*** Interpreted:
4.30user 0.02system 0:04.51elapsed 95%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (1major+2734minor)pagefaults 0swaps
*** Compiled:
5.55user 0.01system 0:05.58elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+2069minor)pagefaults 0swaps

-- 
           Summary: Java interpreter significantly faster than gcc?!
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: java
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: netzberg at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23283


             reply	other threads:[~2005-08-08 10:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-08 10:04 netzberg at gmail dot com [this message]
2005-08-08 13:32 ` [Bug java/23283] Sun's JIT faster than gcc pinskia at gcc dot gnu dot org
2005-08-08 13:33 ` [Bug java/23283] Sun's JIT faster than gcc for Random.nextDouble pinskia at gcc dot gnu dot org
2005-08-23 14:15 ` tromey at gcc dot gnu dot org
2005-08-23 14:31 ` mark at klomp dot org
2005-08-23 14:48 ` bonzini at gcc dot gnu dot org
2005-08-23 14:51 ` bonzini at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050808100453.23283.netzberg@gmail.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).