mersenneforum.org  

Go Back   mersenneforum.org > Factoring Projects > Factoring

Reply
 
Thread Tools
Old 2016-01-08, 06:58   #1
Till
 
Till's Avatar
 
"Tilman Neumann"
Jan 2016
Germany

443 Posts
Default PSIQS java package discussion

Hello everybody!

In the last couple of months I realized a new Java package for integer factorization. I called it PSIQS (puh, the name still seems to be free) and it comes with SquFoF, Cfrac, basic QS, MPQS, SIQS, a parallel SIQS implementation and some other small algorithms. It can be found here:
http://www.tilman-neumann.de/index.html

My main goals were stability and readable code. I hope you'll like it.

please post your comments and questions about my PSIQS java factoring package here.
I'll try to login regularly to give feedback.

Two initial remarks:
1. The jar terminates with an exception when shutdown via Ctrl-C. I am sorry about that but since it doesn't affect the functionality, I consider it a minor issue.

2. I would be most interested if you like the design of the software.

Tilman Neumann

Last fiddled with by jasonp on 2016-01-10 at 11:48 Reason: added notes
Till is offline   Reply With Quote
Old 2016-01-08, 09:39   #2
Dubslow
Basketry That Evening!
 
Dubslow's Avatar
 
"Bunslow the Bold"
Jun 2011
40<A<43 -89<O<-88

3·29·83 Posts
Default

Very interesting! What is your motivation for making such an educational resource (yet that is competitive performance wise)? Well done, regardless!
Dubslow is offline   Reply With Quote
Old 2016-01-08, 14:36   #3
Till
 
Till's Avatar
 
"Tilman Neumann"
Jan 2016
Germany

443 Posts
Default

Quote:
Originally Posted by Dubslow View Post
Very interesting! What is your motivation for making such an educational resource (yet that is competitive performance wise)? Well done, regardless!
Thanks.

The basic motivation was to learn how the stuff works. I am a computer scientist but this thing somehow caught me.
Then it's mostly my programming style, I guess. I don't like unreadable code ;)
Third, the matter is sometimes so difficult that I felt that I had to work it out as clearly as possible to avoid stupid mistakes.

Last fiddled with by Till on 2016-01-08 at 15:32 Reason: added basic motivation
Till is offline   Reply With Quote
Old 2016-01-08, 16:56   #4
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

24×5×17 Posts
Default PSIQS java package discussion

A Java stand-alone application will always be faster than an applet, which is constrained by the browser. Have you ran your application using the same memory settings my applet uses? (256 MB of memory).
alpertron is offline   Reply With Quote
Old 2016-01-08, 17:29   #5
Till
 
Till's Avatar
 
"Tilman Neumann"
Jan 2016
Germany

443 Posts
Default

Quote:
Originally Posted by alpertron View Post
A Java stand-alone application will always be faster than an applet, which is constrained by the browser. Have you ran your application using the same memory settings my applet uses? (256 MB of memory).
Hola maestro,
of course my program needs more memory than yours. I noticed that your applet needs hardly any GC at all; I am not that far. But for comparison, I didn't run your program as an applet, I interfaced the factoringSiqs() method.

Should I open a separate discussion thread?

Best regards
Till
Till is offline   Reply With Quote
Old 2016-01-08, 17:48   #6
bsquared
 
bsquared's Avatar
 
"Ben"
Feb 2007

DAA16 Posts
Default

Quote:
Originally Posted by Till View Post
Thanks.

The basic motivation was to learn how the stuff works. I am a computer scientist but this thing somehow caught me.
Then it's mostly my programming style, I guess. I don't like unreadable code ;)
Third, the matter is sometimes so difficult that I felt that I had to work it out as clearly as possible to avoid stupid mistakes.
Well done!

New implementations of these difficult algorithms are commendable. And as someone who is particularly guilty of unreadable code, it is nice to see the operations laid out "in plain sight", and yet still efficient. .
bsquared is offline   Reply With Quote
Old 2016-01-08, 18:03   #7
Till
 
Till's Avatar
 
"Tilman Neumann"
Jan 2016
Germany

443 Posts
Default

Quote:
Originally Posted by bsquared View Post
Well done!

New implementations of these difficult algorithms are commendable. And as someone who is particularly guilty of unreadable code, it is nice to see the operations laid out "in plain sight", and yet still efficient. .
Thank you!
Well, lets say that I hope it is sufficiently "laid out in plain sight". That was my plan, but there is always a trade-off...
You are the one who did "YAFU" ? Without regard to the readability of your code, I am quite sure you can teach me some lessons, and I hope you will :)

Best regards
Till
Till is offline   Reply With Quote
Old 2016-01-08, 18:13   #8
alpertron
 
alpertron's Avatar
 
Aug 2002
Buenos Aires, Argentina

24·5·17 Posts
Default

In order to make the program to use as little memory as possible, I tried not to use objects and to use arrays of primitive types only if possible. I also placed lots of methods inside the same class, which runs faster than having lots of classes. This probably reduced readability for people used to read object-oriented programming source code.

One of the most important tips is not to exceed 8000 bytes of bytecode in a particular method when the classes are compiled, because in that case, the JVM interprets the method, instead of using the JIT feature.

Last fiddled with by alpertron on 2016-01-08 at 18:25
alpertron is offline   Reply With Quote
Old 2016-01-08, 18:45   #9
Till
 
Till's Avatar
 
"Tilman Neumann"
Jan 2016
Germany

443 Posts
Default

Quote:
Originally Posted by alpertron View Post
In order to make the program to use as little memory as possible, I tried not to use objects and to use arrays of primitive types only if possible. I also placed lots of methods inside the same class, which runs faster than having lots of classes. This probably reduced readability for people used to read object-oriented programming source code.

One of the most important tips is not to exceed 8000 bytes of bytecode in a particular method when the classes are compiled, because in that case, the JVM interprets the method, instead of using the JIT feature.
I started to work on the first point. I wouldn't break the readability for performance, though. I think that math is a question of algorithms, not of bit-fiddling or that kind of stuff. Thus one should enable others to implement new ideas quickly. But this is my personal view, and I know one cannot reach the "top of the hill" with that philosophy. (in the end, to be on the top of the hill, all tricks are required ;))

About the last point: I think that I do not have methods that exceed 8k code.
Till is offline   Reply With Quote
Old 2016-01-09, 22:13   #10
storflyt32
 
Feb 2013

2×229 Posts
Default

My apologies.

One question here.

Everyone knows that BASIC is an interpreter based language in which the high level commands need to be interpreted or translated into assembler or machine code which can be executed directly by the processor.

Pascal is such a language. Depending on version, a software program needs to first be compiled and next executed.

Therefore Pascal is much faster to run programs than BASIC.

What about Java then? Is it an interpreter based or executable language?

I am not familiar with the language, but my guess is that it should be run in the same way as Pascal, meaning by means of assembler or machine code directly.

Last fiddled with by storflyt32 on 2016-01-09 at 22:15
storflyt32 is offline   Reply With Quote
Old 2016-01-10, 08:06   #11
debrouxl
 
debrouxl's Avatar
 
Sep 2009

97710 Posts
Default

Java is usually compiled to bytecode, then some bits are dynamically converted to native code at runtime (Just In Time translation), based on heuristics. Execution can revert from JITed code to bytecode under some circumstances.

Outside of micro-benchmarks, performance of JITed code rarely exceeds that of the equivalent native code compiled the normal way; profile-guided optimization yields a small speed boost in native code. For this reason, production code for heavy computations usually remains written in FORTRAN, C or C++, with some assembly bits if necessary (though for C and C++, compilers implement an ever growing number of intrinsics and thereby reduce the need to use assembly directly).
debrouxl is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
being able to use a latex package wildrabbitt Software 7 2018-01-12 19:46
Debian package of mprime Matt Linux 1 2007-02-22 22:36
Understandable QS java Implementation ThiloHarich Factoring 41 2005-11-28 21:18
Improvements for the CWI NFS software package Istari Factoring 30 2005-07-12 20:20
Free C++ package and looking for a bit of help. Uncwilly Programming 9 2005-03-04 13:37

All times are UTC. The time now is 22:39.

Wed Jun 16 22:39:48 UTC 2021 up 19 days, 20:27, 0 users, load averages: 2.28, 2.35, 2.25

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.