* Re: why gcj is slower than jvm
[not found] <200309040203.h8423cM17594@ops2.one-point.com>
@ 2003-09-04 3:08 ` Jeff Sturm
0 siblings, 0 replies; 8+ messages in thread
From: Jeff Sturm @ 2003-09-04 3:08 UTC (permalink / raw)
To: guw; +Cc: Andrew Haley, gcc, gcc-help
On Thu, 4 Sep 2003, guw wrote:
> Can you tell me how demonstrate GCJ's runtime performance is better than JVM?
Are you looking for benchmarks? A google.com search turns up many, one of
the more interesting ones is
http://www.shudo.net/jit/perf/
> and how incarnate the GCJ's runtime performance or compiler optimization?
I'm not sure I understand the question.
Jeff
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: why gcj is slower than jvm
2003-09-03 6:35 ` Jeff Sturm
@ 2003-09-04 18:28 ` Mark Wielaard
0 siblings, 0 replies; 8+ messages in thread
From: Mark Wielaard @ 2003-09-04 18:28 UTC (permalink / raw)
To: Jeff Sturm; +Cc: guw, gcc, gcc-help, Raif S. Naffah
Hi,
On Wed, Sep 03, 2003 at 02:34:50AM -0400, Jeff Sturm wrote:
> Your example is more of a comparison of runtime performance than compiler
> optimization. From your results one might conclude that the JVM has a
> better MD-5 implementation than libjava, but little else.
The GNU-Crypto hackers have offered their MD5 and SHA-1 implementations.
They are noticably faster. It is on my list of things to merge into GNU
Classpath (which is the upstream library source of libgcj).
You can already use their implemeentation by installing a GCJ-friendly
GNU-Crypto <http://www.gnu.org/software/gnu-crypto/> and replacing the
security.privider.1 in lib/security/classpath.security with
gnu.crypto.jce.GnuCrypto.
Cheers,
Mark
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: why gcj is slower than jvm
@ 2003-09-04 2:03 guw
0 siblings, 0 replies; 8+ messages in thread
From: guw @ 2003-09-04 2:03 UTC (permalink / raw)
To: Andrew Haley; +Cc: gcc
[-- Attachment #1: Type: text/plain, Size: 818 bytes --]
Andrew Haley,hello!
Can you tell me how demonstrate GCJ's runtime performance is better than JVM?
and how incarnate the GCJ's runtime performance or compiler optimization?
Had better give me a little example.
thanks.
======= 2003-09-03 11:17:00 =======
>guw writes:
> > Hello!
> > I write a JAVA programme and compile it with GCJ. then I compare GCJ's performance with JVM'performance,but I discover that the procedure to be GCJ compiled is slower than JVM.
> > why?
>
>My guess would be that libgcj's implementation of SHA-1 is slower than
>that in whatever JVM you were using. I expect that SHA-1 could be
>made to run very much faster.
>
>Andrew.
= = = = = = = = = = = = = = = = = = = =
guw
guw@koal.com
2003-09-04
[-- Attachment #2: Rabbit.GIF --]
[-- Type: image/gif, Size: 1488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: why gcj is slower than jvm
@ 2003-09-04 2:03 guw
0 siblings, 0 replies; 8+ messages in thread
From: guw @ 2003-09-04 2:03 UTC (permalink / raw)
To: Andrew Haley; +Cc: gcc
[-- Attachment #1: Type: text/plain, Size: 818 bytes --]
Andrew Haley,hello!
Can you tell me how demonstrate GCJ's runtime performance is better than JVM?
and how incarnate the GCJ's runtime performance or compiler optimization?
Had better give me a little example.
thanks.
======= 2003-09-03 11:17:00 =======
>guw writes:
> > Hello!
> > I write a JAVA programme and compile it with GCJ. then I compare GCJ's performance with JVM'performance,but I discover that the procedure to be GCJ compiled is slower than JVM.
> > why?
>
>My guess would be that libgcj's implementation of SHA-1 is slower than
>that in whatever JVM you were using. I expect that SHA-1 could be
>made to run very much faster.
>
>Andrew.
= = = = = = = = = = = = = = = = = = = =
guw
guw@koal.com
2003-09-04
[-- Attachment #2: Rabbit.GIF --]
[-- Type: image/gif, Size: 1488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* why gcj is slower than jvm
[not found] <200309030606.h8366al31582@mx1.redhat.com>
@ 2003-09-03 10:18 ` Andrew Haley
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Haley @ 2003-09-03 10:18 UTC (permalink / raw)
To: guw; +Cc: gcc, gcc, gcc-help
guw writes:
> Hello!
> I write a JAVA programme and compile it with GCJ. then I compare GCJ's performance with JVM'performance,but I discover that the procedure to be GCJ compiled is slower than JVM.
> why?
My guess would be that libgcj's implementation of SHA-1 is slower than
that in whatever JVM you were using. I expect that SHA-1 could be
made to run very much faster.
Andrew.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: why gcj is slower than jvm
[not found] <200309030606.h83667M14509@ops2.one-point.com>
@ 2003-09-03 6:35 ` Jeff Sturm
2003-09-04 18:28 ` Mark Wielaard
0 siblings, 1 reply; 8+ messages in thread
From: Jeff Sturm @ 2003-09-03 6:35 UTC (permalink / raw)
To: guw; +Cc: gcc, gcc-help
On Wed, 3 Sep 2003, guw wrote:
> I write a JAVA programme and compile it with GCJ. then I compare
> GCJ's performance with JVM'performance,but I discover that the procedure
> to be GCJ compiled is slower than JVM.
Your example is more of a comparison of runtime performance than compiler
optimization. From your results one might conclude that the JVM has a
better MD-5 implementation than libjava, but little else.
Jeff
^ permalink raw reply [flat|nested] 8+ messages in thread
* why gcj is slower than jvm
@ 2003-09-03 6:05 guw
0 siblings, 0 replies; 8+ messages in thread
From: guw @ 2003-09-03 6:05 UTC (permalink / raw)
To: gcc
[-- Attachment #1: Type: text/plain, Size: 2260 bytes --]
Hello!
I write a JAVA programme and compile it with GCJ. then I compare GCJ's performance with JVM'performance,but I discover that the procedure to be GCJ compiled is slower than JVM.
why?
thanks.
===============================================================================
Output data:
JVM:
SHA1: Hashing 100000 blocks of 500 bytes each: time = 5.276, speed = 9254.762 KB/s
MD5: Hashing 100000 blocks of 500 bytes each: time = 3.578, speed = 13646.765 KB/s
GCJ:
SHA1: Hashing 100000 blocks of 500 bytes each: time = 8.719, speed = 5600.1978 KB/s
MD5: Hashing 100000 blocks of 500 bytes each: time = 14.337, speed = 3405.7422 KB/s
===============================================================================
Compiled command:
gcj -O2 --main=HashSpeed HashSpeed.class -o HashSpeed.exe
===============================================================================
Source code:
import java.security.MessageDigest;
import java.util.Iterator;
public class HashSpeed {
public static void main(String[] args) {
if (args == null || args.length == 0) {
speed("SHA-1");
}
else{
int i=0;
while(i<args.length){
speed(args[i++]);
}
}
}
private static void speed(String name) {
try {
MessageDigest hash = MessageDigest.getInstance(name);
speed(hash);
} catch (Exception x) {
System.out.println(name+": Failed self-test...:"+x.getLocalizedMessage());
}
}
private static void speed(MessageDigest hash) {
try {
int iterations = 100000;
int blocksize = 500;
byte[] data = new byte[blocksize];
int i;
for (i = 0; i < blocksize; i++) {
data[i] = (byte) i;
}
System.out.print(hash.getAlgorithm()+": Hashing "+String.valueOf(iterations)
+" blocks of "+String.valueOf(blocksize)+" bytes each: ");
long elapsed = -System.currentTimeMillis();
for (i = 0; i < iterations; i++) {
hash.update(data, 0, blocksize);
}
elapsed += System.currentTimeMillis();
float secs = (elapsed > 1) ? (float) elapsed / 1000 : 1;
float speed = (float) iterations * blocksize / 1024 / secs;
System.out.println("time = "+secs+", speed = "+speed+" KB/s");
} catch (Exception x) {
x.printStackTrace(System.err);
}
}
}
archer
guw@koal.com
[-- Attachment #2: Rabbit.GIF --]
[-- Type: image/gif, Size: 1488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* why gcj is slower than jvm
@ 2003-09-03 6:05 guw
0 siblings, 0 replies; 8+ messages in thread
From: guw @ 2003-09-03 6:05 UTC (permalink / raw)
To: gcc
[-- Attachment #1: Type: text/plain, Size: 2260 bytes --]
Hello!
I write a JAVA programme and compile it with GCJ. then I compare GCJ's performance with JVM'performance,but I discover that the procedure to be GCJ compiled is slower than JVM.
why?
thanks.
===============================================================================
Output data:
JVM:
SHA1: Hashing 100000 blocks of 500 bytes each: time = 5.276, speed = 9254.762 KB/s
MD5: Hashing 100000 blocks of 500 bytes each: time = 3.578, speed = 13646.765 KB/s
GCJ:
SHA1: Hashing 100000 blocks of 500 bytes each: time = 8.719, speed = 5600.1978 KB/s
MD5: Hashing 100000 blocks of 500 bytes each: time = 14.337, speed = 3405.7422 KB/s
===============================================================================
Compiled command:
gcj -O2 --main=HashSpeed HashSpeed.class -o HashSpeed.exe
===============================================================================
Source code:
import java.security.MessageDigest;
import java.util.Iterator;
public class HashSpeed {
public static void main(String[] args) {
if (args == null || args.length == 0) {
speed("SHA-1");
}
else{
int i=0;
while(i<args.length){
speed(args[i++]);
}
}
}
private static void speed(String name) {
try {
MessageDigest hash = MessageDigest.getInstance(name);
speed(hash);
} catch (Exception x) {
System.out.println(name+": Failed self-test...:"+x.getLocalizedMessage());
}
}
private static void speed(MessageDigest hash) {
try {
int iterations = 100000;
int blocksize = 500;
byte[] data = new byte[blocksize];
int i;
for (i = 0; i < blocksize; i++) {
data[i] = (byte) i;
}
System.out.print(hash.getAlgorithm()+": Hashing "+String.valueOf(iterations)
+" blocks of "+String.valueOf(blocksize)+" bytes each: ");
long elapsed = -System.currentTimeMillis();
for (i = 0; i < iterations; i++) {
hash.update(data, 0, blocksize);
}
elapsed += System.currentTimeMillis();
float secs = (elapsed > 1) ? (float) elapsed / 1000 : 1;
float speed = (float) iterations * blocksize / 1024 / secs;
System.out.println("time = "+secs+", speed = "+speed+" KB/s");
} catch (Exception x) {
x.printStackTrace(System.err);
}
}
}
archer
guw@koal.com
[-- Attachment #2: Rabbit.GIF --]
[-- Type: image/gif, Size: 1488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2003-09-04 18:28 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <200309040203.h8423cM17594@ops2.one-point.com>
2003-09-04 3:08 ` why gcj is slower than jvm Jeff Sturm
2003-09-04 2:03 guw
-- strict thread matches above, loose matches on Subject: below --
2003-09-04 2:03 guw
[not found] <200309030606.h8366al31582@mx1.redhat.com>
2003-09-03 10:18 ` Andrew Haley
[not found] <200309030606.h83667M14509@ops2.one-point.com>
2003-09-03 6:35 ` Jeff Sturm
2003-09-04 18:28 ` Mark Wielaard
2003-09-03 6:05 guw
2003-09-03 6:05 guw
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).