[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNU Crypto] performance issues
From: |
Raif S. Naffah |
Subject: |
[GNU Crypto] performance issues |
Date: |
Mon, 28 Oct 2002 00:30:27 +1100 |
User-agent: |
KMail/1.4.3 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
hello there,
just before i call it a day ;-) i'd like to share with you the results
of a test i wrote today:
the code is:
- ----- begin Performance.java -----
public class Performance {
private static final int ROUNDS = 100000;
// default constructor
public static final void main(String[] args) {
int i, j;
long t1 = 0, t2 = 0;
// comparing System.arraycopy to plain for loop
byte[] src = new byte[256];
byte[] dst = new byte[256];
for (i = 0; i < 256; i++) {
src[i] = (byte) i;
}
t1 = -System.currentTimeMillis();
for (i = 0; i < ROUNDS; i++) {
for (j = 0; j < 256; j++) {
dst[j] = src[j];
}
}
t1 += System.currentTimeMillis();
t2 = -System.currentTimeMillis();
for (i = 0; i < ROUNDS; i++) {
System.arraycopy(src, 0, dst, 0, 256);
}
t2 += System.currentTimeMillis();
System.out.println("*** Test #1: System.arraycopy / for loop");
System.out.println(" for loop: "+t1);
System.out.println(" arraycopy: "+t2);
}
}
- ----- end Performance.java -----
this is how i compiled and tested it:
$ jikes -classpath /usr/java/jdk1.3.1_05/jre/lib/rt.jar:. -d classes
src/Performance.java
$ java -classpath classes Performance
*** Test #1: System.arraycopy / for loop
for loop: 350
arraycopy: 26
$ gcj --main=Performance -o Performance src/Performance.java
$ ./Performance
*** Test #1: System.arraycopy / for loop
for loop: 397
arraycopy: 18
$ gcj -march=athlon-xp -O3 -fno-bounds-check --main=Performance -o
Performance src/Performance.java
$ ./Performance
*** Test #1: System.arraycopy / for loop
for loop: 72
arraycopy: 19
* Jikes Compiler - Version 1.17 - 27 September 2002
* java version "1.3.1_05"
* gcj (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
i intend to add more tests to this class so as to gain better insight at
a. which constructs have better performance impact, and
b. which alternative to use to get the most out of GCJ.
ideas and suggestions are welcome + cheers;
rsn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Que du magnifique
iD8DBQE9u+pz+e1AKnsTRiERA+KzAKCM5PMyB4UpI7PTJDKl3ldDTEePHACgpNcL
nztzl93FUarcL5uDoMug0Y0=
=WIPP
-----END PGP SIGNATURE-----
- [GNU Crypto] performance issues,
Raif S. Naffah <=