mersenneforum.org  

Go Back   mersenneforum.org > Factoring Projects > Factoring

Reply
 
Thread Tools
Old 2006-12-19, 17:14   #23
ThiloHarich
 
ThiloHarich's Avatar
 
Nov 2005

10110 Posts
Default

I ran them under JDK 1.5_08. I'am going to try 1.4.
What (avalible) JVM has the best performance?
ThiloHarich is offline   Reply With Quote
Old 2006-12-19, 17:51   #24
ThiloHarich
 
ThiloHarich's Avatar
 
Nov 2005

101 Posts
Default

I tried hashing.

I also optimized my parameters. Resieving is much to slow.
Checking if the x of q(x) = (ax+b)^2-N has a solution mod p is cheaper then hashing the values of q(x) or x. I do this even with the small primes. It is faster then the trial division on primitive (long) types.
The trial division stage needs only half of the time of sieving for 60 Digits.

For hashing I added an additional statement to hash the factors. I did not hash the length itself. To advoid the collisions of this values the hash has to be great. The initialization is expensive.
ThiloHarich is offline   Reply With Quote
Old 2006-12-19, 19:38   #25
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

17·79 Posts
Default

Quote:
Originally Posted by ThiloHarich View Post
Hi Dario,
I am not very familar with applets. Can you start an applet with start options?
The -server option enables Hotspot, which helps a lot. The sieving routine can be replaced with the compiled code. This nearly halfes the execution Time. My code (and your applet) runs under JDK 1.5. Under JDK 1.6 my app runs much slower. I have not tried it under 1.4 (it is JDK 1.5 code style).

Here were my start options: -server -Xmx500M -Xms500m -XX:+UseParallelGC -XX:ParallelGCThreads=1

Factor 30 is realy a lot, i have to run other examples.
You will need to read this paragraph of the file README.TXT on the JRE:

Quote:
Originally Posted by README.TXT
On Microsoft Windows platforms, the JDK includes both the Java HotSpot Server VM and Java HotSpot Client VM. However, the J2SE Runtime Environment for Microsoft Windows platforms includes only the Java HotSpot Client VM. Those wishing to use the Java HotSpot Server VM with the J2SE Runtime Environment may copy the JDK's jre\bin\server folder to a bin\server
directory in the J2SE Runtime Environment. Software vendors may redistribute the Java HotSpot Server VM with their redistributions of the J2SE Runtime Environment.
This means that on the standard JRE installation only the client can be run, not the server version of the Virtual Machine.
alpertron is offline   Reply With Quote
Old 2006-12-19, 20:00   #26
Mystwalker
 
Mystwalker's Avatar
 
Jul 2004
Potsdam, Germany

83110 Posts
Default

If you want maximal performance of Java applications, you should consider using a Java native compiler that disables array bound checking. gcj can do this, IIRC.

Quote:
Originally Posted by ThiloHarich View Post
The -server option enables Hotspot, which helps a lot.
As far as I know, the -server option forces the JVM to compile all bytecode at the beginning. Without it, the Hotspot compiler does a compilation of often needed parts on the fly.

For an application as compact as these (compared to application servers and such), I'd guess that there is no significant performance difference.
When the computation takes long, the often needed part have been compiled anyway. When the computation is short, the Hotspot approach is better, as it didn't have to compile the whole code at first.

"-server" is really useful when you have applications that need maximal performance and especially a minimal response time, but also have a large quantity of code that only gets used rarely. On the other hand, memory consumption and start-up time should be less important.
Mystwalker is offline   Reply With Quote
Old 2006-12-19, 21:16   #27
xilman
Bamboozled!
 
xilman's Avatar
 
"π’‰Ίπ’ŒŒπ’‡·π’†·π’€­"
May 2003
Down not across

245448 Posts
Default

Quote:
Originally Posted by alpertron View Post
It is like the CPU manufacturers are paying Sun to make the JRE slower so they can sell the latest microprocessors.
Remember the old saying? Write once, crawl anywhere?


Paul
xilman is offline   Reply With Quote
Old 2006-12-20, 09:00   #28
ThiloHarich
 
ThiloHarich's Avatar
 
Nov 2005

101 Posts
Default

@ Mystwalker

thanks for the link I have to try it.

Concerning HotSpot:

look at http://java.sun.com/products/hotspot/whitepaper.html:

Rather than compiling method by method, just in time, the Java HotSpot VM immediately runs the program using an interpreter, and analyzes the code as it runs to detect the critical hot spots in the program. Then it focuses the attention of a global native-code optimizer on the hot spots. ..
This hot spot monitoring is continued dynamically as the program runs, so that it literally adapts its performance on the fly to the user's needs.

Since we spent much time in the sieving loop, the hotspot works good. As I already said it cuts down execution time to about 50%.

@ alpertron I tried your applet with the idm jdk 5.0 JVM. It seems to be slower then with the sun JDK 5.
ThiloHarich is offline   Reply With Quote
Old 2006-12-20, 18:34   #29
Mystwalker
 
Mystwalker's Avatar
 
Jul 2004
Potsdam, Germany

3·277 Posts
Default

Ok, my memory was flawed.
Do you have benchmark comparisons between the server and the client HotSpot compiler?
Mystwalker is offline   Reply With Quote
Old 2006-12-21, 10:17   #30
ThiloHarich
 
ThiloHarich's Avatar
 
Nov 2005

101 Posts
Default

Here were my results based on my Factoring Algorithm:
The execution times relative to JDK 1.5.0 _08 -server which was the fastest

JDK 1.4 _12 1,43
JDK 1.4_12 -server 1,05

JDK 1.5.0 _08 1,48
JDK 1.5.0 _08 -server 1,00

JDK 1.6.0 1,16
JDK 1.6.0 -server 1,02

IBM JAVA 5 -Xnojit ~ 7
IBM JAVA 5 1,00

@ alpertron JDK 1.6 works good without -server

Last fiddled with by ThiloHarich on 2006-12-21 at 11:15
ThiloHarich is offline   Reply With Quote
Old 2006-12-21, 11:39   #31
ThiloHarich
 
ThiloHarich's Avatar
 
Nov 2005

101 Posts
Default

I found an other resource:

At http://www.shudo.net/jit/perf/

There you can find the Eratosthenes Sieve (which is very similar to the sieving routine):

IBM JDK 1.4.2 13327
IBM JDK 1.3.1 13308
JRockit (-server) 13197
GCJ (-O2 with .java) 13141
JRockit (-client) 12991
C#/.NET (Release) 12735
GCJ (-O2 with .class) 12057
Sun JDK 1.4.2 Server VM 11992
Sun JDK 1.5.0 Server VM 11174
Jikes RVM 9555
C#/Mono 1.1.3 (JIT) 9420
Kaffe 9024
C#/.NET (Debug) 8217
C#/Mono 1.0.2 (JIT) 8047
Sun JDK 1.4.2 Client VM 7546
Sun JDK 1.5.0 Client VM 7275
OpenJIT 6587
sunwjit 6269
GCJ (-O0 with .java) 5488
shuJIT 5005
TYA 4756
GCJ (-O0 with .class) 4350
interpreter 515
C#/Mono 1.0.2 (interpreter) 343
C#/Mono 1.1.3 (interpreter) 337

Why is msieve so dammed fast?
ThiloHarich is offline   Reply With Quote
Old 2006-12-21, 12:49   #32
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

17×79 Posts
Default

If you want to run the SIQS routine only in my applet, after entering the number to be factored, you have to type the number zero on the lower left box and press the "curve" button. The applet will finish the current ECM curve and then switches to SIQS.
alpertron is offline   Reply With Quote
Old 2006-12-21, 13:31   #33
ThiloHarich
 
ThiloHarich's Avatar
 
Nov 2005

101 Posts
Default

Thanks for this suggestion, this helps a lot.
ThiloHarich is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Quadratic Sieve Ilya Gazman Factoring 3 2016-02-22 11:32
Quadratic Sieve by Hand Sam Kennedy Factoring 20 2013-01-09 16:50
Finding B in Quadratic Sieve paul0 Factoring 3 2011-09-22 17:12
Possible improvement of quadratic sieve Random Poster Factoring 4 2010-02-12 03:09
Quadratic Sieve in wikipedia.de ThiloHarich Factoring 5 2006-07-14 09:51

All times are UTC. The time now is 06:55.

Mon Mar 8 06:55:18 UTC 2021 up 95 days, 3:06, 0 users, load averages: 2.49, 2.51, 2.41

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.