Re: Replacement for GMP: Update

2007-01-24 Thread Thorkil Naur
Hello, On Wednesday 24 January 2007 16:30, Peter Tanski wrote: > ... > Thorkil Naur and others have suggested writing the whole > thing as small assembler operations and piece them together in > Haskell; I have been looking into that as well but it seems to entail > inlining every Integer f

Re: Replacement for GMP: Update

2007-01-24 Thread Peter Tanski
On Tue, 23 Jan 2007, John Meacham wrote: I think the benchmarks are flawed in an important way, I believe, (but am not positive) that ARPREC uses a special factorized form of representing numbers, which makes multiplicative type operations extremely fast, but simple things like addition/subtracti

Re: Replacement for GMP: Update

2007-01-23 Thread John Meacham
I think the benchmarks are flawed in an important way, I believe, (but am not positive) that ARPREC uses a special factorized form of representing numbers, which makes multiplicative type operations extremely fast, but simple things like addition/subtraction quite slow. you are only benchmarking m

Re: Replacement for GMP: Update

2007-01-02 Thread Peter Tanski
On Dec 29, 2006, at 8:32 AM, Thorkil Naur wrote: On Friday 01 September 2006 06:43, Peter Tanski wrote: ... For a brief overview of the speed of the libraries I looked at carefully, see http://hackage.haskell.org/trac/ghc/wiki/ ReplacingGMPNotes (I added a few charts to show the speed of A

Re: Replacement for GMP: Update

2006-12-29 Thread Thorkil Naur
Hello, Thanks a lot for your reply. Here are some comments to this. As is customary, I must apologise for the late reply (the response time for this conversation seems to increase exponentially with time) which also may very well make some of the comments totally out-dated. On Friday 01 Septem

Re: Replacement for GMP: Update

2006-08-31 Thread Peter Tanski
Hello Thorkil, I am very sorry for the late reply. I have been extremely busy and I wanted to give you a coherent answer. For a brief overview of the speed of the libraries I looked at carefully, see http://hackage.haskell.org/trac/ghc/wiki/ReplacingGMPNotes (I added a few charts to show

Re: Replacement for GMP: Update

2006-08-24 Thread Thorkil Naur
Hello Peter, Sorry for the late reply. From your latest communication which seems to be Date: Sat, 12 Aug 2006 21:12:05 -0400 From: Peter Tanski <[EMAIL PROTECTED]> Subject: Re: OpenSSL License (was Replacement for GMP: Update) To: John Goerzen <[EMAIL PROTECTED]> I am a bit uncerta

RE: Re[2]: Replacement for GMP: Update

2006-08-22 Thread Simon Marlow
On 21 August 2006 16:20, Bulat Ziganshin wrote: > Hello Simon, > > Monday, August 21, 2006, 6:55:47 PM, you wrote: > >> Parallel major GC was worked on by Roshan James during his >> internship here this summer, and we have some working code, but it >> needs a lot more testing and tuning, and it m

Re[2]: Replacement for GMP: Update

2006-08-21 Thread Bulat Ziganshin
Hello Simon, Monday, August 21, 2006, 6:55:47 PM, you wrote: >> is not exactly true. look at "Non-stop Haskell" > Simply because it adds overhead (both in runtime and code complexity), and the > benefits are relatively modest. i think that GC that don't stops the world is just a different produ

Re: Replacement for GMP: Update

2006-08-21 Thread Simon Marlow
Bulat Ziganshin wrote: Hello skaller, Sunday, August 13, 2006, 4:34:14 AM, you wrote: But the state of the art is then two stages behind the requirement: Haskell still has to 'world stop' threads to do a major collection. is not exactly true. look at "Non-stop Haskell" (http://www.haskell.o

Re[8]: Replacement for GMP: Update

2006-08-14 Thread Bulat Ziganshin
Hello skaller, Sunday, August 13, 2006, 4:34:14 AM, you wrote: > I know very little about Haskell, let alone GHC internals me too. so it's better to wait for comments about your thoughts from GHC team than from me. but at least i can said that > But the state of the art is then two stages behin

Re: OpenSSL License (was Replacement for GMP: Update)

2006-08-12 Thread Peter Tanski
John, Have you carefully investigated the OpenSSL license? We in Debian have had repeated problems since the OpenSSL license is, as written, incompatible with the GPL (even linking to OpenSSL is incompatible with the GPL). I would hate to have a situation where all GHC-compiled programs c

Re: Re[6]: Replacement for GMP: Update

2006-08-12 Thread skaller
On Sat, 2006-08-12 at 16:58 +0400, Bulat Ziganshin wrote: > Hello skaller, hi .. :) > > The problem will occur if the 'stack' is aged: in that case > > the sweep can miss the mutation and reap a live object. > > well, i don't know how updatable vars in stack interoperate with GC. > let's someone

Re[6]: Replacement for GMP: Update

2006-08-12 Thread Bulat Ziganshin
Hello skaller, Saturday, August 12, 2006, 12:34:54 PM, you wrote: >> > My point here is that actually this is a disastrous optimisation >> > in a multi-processing environment, because in general, the >> > assignment of a pointer means the store isn't write once. >> >> :) all the variables rewr

Re: Replacement for GMP: Update

2006-08-12 Thread Peter Tanski
Florian: On most systems, readline is GPLed. There is a non-copyleft reimplementation somewhere, but I don't think it's widely used. The non-copyleft implementation is an upgrade from BSD's lineedit, called libedit . Apple's OS X includes it as a version

Re: Replacement for GMP: Update

2006-08-12 Thread John Goerzen
On 2006-08-10, Peter Tanski <[EMAIL PROTECTED]> wrote: > Summary: I finally settled on modifying OpenSSL, since that would be > the easiest to work with under GHC's hood (plain C code, not C++). I > have to: Have you carefully investigated the OpenSSL license? We in Debian have had repeated

Re: Re[4]: Replacement for GMP: Update

2006-08-12 Thread skaller
On Sat, 2006-08-12 at 10:58 +0400, Bulat Ziganshin wrote: > Hello skaller, > > Saturday, August 12, 2006, 7:06:15 AM, you wrote: > > > My point here is that actually this is a disastrous optimisation > > in a multi-processing environment, because in general, the > > assignment of a pointer means

Re[4]: Replacement for GMP: Update

2006-08-12 Thread Bulat Ziganshin
Hello skaller, Saturday, August 12, 2006, 7:06:15 AM, you wrote: > My point here is that actually this is a disastrous optimisation > in a multi-processing environment, because in general, the > assignment of a pointer means the store isn't write once. :) all the variables rewritten is local t

Re: Replacement for GMP: Update

2006-08-11 Thread Florian Weimer
* Peter Tanski: > Quite right; my mistake: under the OpenSSL license a developer cannot > mention features of the software in advertising materials, so the > license grant of the GPL-OpenSSL program to the developer is void. > The reason I mentioned "users" only was that in the particular > proble

Re: Re[2]: Replacement for GMP: Update

2006-08-11 Thread skaller
On Fri, 2006-08-11 at 18:56 -0400, Peter Tanski wrote: > John, > > > After all on the average call where an object of that > > size is free already it is a single array lookup, we have: > > > > (a) fetch pointer (one read) > > (b) fetch next (one read) > > (c) store next as current (one write) >

Re: Replacement for GMP: Update

2006-08-11 Thread skaller
On Fri, 2006-08-11 at 21:08 +0100, Brian Hulley wrote: > Florian Weimer wrote: > > This is the offending part: > > > > * 3. All advertising materials mentioning features or use of this > > software > > *must display the following acknowledgement: > > *"This product includes cryptographic so

Re: Re[2]: Replacement for GMP: Update

2006-08-11 Thread Peter Tanski
John, After all on the average call where an object of that size is free already it is a single array lookup, we have: (a) fetch pointer (one read) (b) fetch next (one read) (c) store next as current (one write) This is true for memory access; it is not true for memory allocation. I do not

Re: Replacement for GMP: Update

2006-08-11 Thread Peter Tanski
Brian, Therefore I'd recommend that licenses for code used by GHC runtime should be either BSD or public domain. I agree. I was working on a rewrite of OpenSSL's BN from scratch-- maybe a rewrite of GMP would be better--but that is a huge undertaking for no other reason than these are big

Re: Re[2]: Replacement for GMP: Update

2006-08-11 Thread Peter Tanski
Simon PJ and Bulat, [the] ForeignPtr solution [has] gotten a lot cheaper in GHC 6.6 than it used to be, so it's worth trying. A merit of the approach is that is avoids fiddling with the bignum allocator at all. I actually did not know that until today; I have tried to keep up with the rapid

Re: Replacement for GMP: Update

2006-08-11 Thread Brian Hulley
Florian Weimer wrote: This is the offending part: * 3. All advertising materials mentioning features or use of this software *must display the following acknowledgement: *"This product includes cryptographic software written by * Eric Young ([EMAIL PROTECTED])" *The word 'cryptog

Re: Replacement for GMP: Update

2006-08-11 Thread Peter Tanski
Florian, This is the offending part: * 3. All advertising materials mentioning features or use of this software *must display the following acknowledgement: *"This product includes cryptographic software written by * Eric Young ([EMAIL PROTECTED])" *The word 'cryptograph

Re: Replacement for GMP: Update

2006-08-11 Thread Florian Weimer
* Peter Tanski: > On the other hand, the OpenSSL FAQ at faq.html#LEGAL2> mentions that some "GPL" programs do not allow > binary combination (static linking) or interoperation (dynamic > linking) with OpenSSL. Honestly I have not seen any "GPL" licenses > like t

Re: Replacement for GMP: Update

2006-08-11 Thread Simon Marlow
Einar Karttunen wrote: On 10.08 11:16, Peter Tanski wrote: Paragraph 6 of the OpenSSL (1998-2005) license states that: * 6. Redistributions of any form whatsoever must retain the following *acknowledgment: *"This product includes software developed by the OpenSSL Project *for use i

RE: Re[2]: Replacement for GMP: Update

2006-08-11 Thread Simon Peyton-Jones
kaller | Sent: 11 August 2006 09:21 | To: Bulat Ziganshin | Cc: Peter Tanski; glasgow-haskell-users@haskell.org | Subject: Re: Re[2]: Replacement for GMP: Update | | On Fri, 2006-08-11 at 09:34 +0400, Bulat Ziganshin wrote: | | > why you say that ForeignPtr is slow? afaik, malloc/free is slow,

Re: Re[2]: Replacement for GMP: Update

2006-08-11 Thread skaller
On Fri, 2006-08-11 at 09:34 +0400, Bulat Ziganshin wrote: > why you say that ForeignPtr is slow? afaik, malloc/free is slow, but > starting from ghc 6.6 speed of _using_ ForeignPtr is the same as for Ptr Er, malloc/free is not slow .. its very fast. I implemented an arena based allocator (one whi

Re[2]: Replacement for GMP: Update

2006-08-10 Thread Bulat Ziganshin
Hello Peter, Friday, August 11, 2006, 4:00:40 AM, you wrote: > OpenSSL's BN library is primarily tuned to support cryptography, > particularly the generation of very large primes for public key > cryptosystems. It is possible to separate the BN library out (I am > having some success there a

Re: Replacement for GMP: Update

2006-08-10 Thread Reilly Hayes
I have a Mac as well, but it is an intel one.  GHC does NOT support dynamic linking of Haskell libraries on intel macs, but C libraries like readline & GMP dynamically link just fine.  For example:$ otool -L /usr/local/ghc/lib/ghc-6.5/ghc-6.5/usr/local/ghc/lib/ghc-6.5/ghc-6.5:        /usr/local/lib

Re: Replacement for GMP: Update

2006-08-10 Thread Peter Tanski
Reilly, ... this shouldn't prohibit linking GMP in dynamically, should it? It's just a C library and GCC should happily generate relocatable code. As a dynamically linked library, there should be no tainting issues to worry about even if the dynamically linked code is shipped with the executa

Re: Replacement for GMP: Update

2006-08-10 Thread Alec Berryman
Reilly Hayes on 2006-08-10 18:36:49 -0700: > There's one thing I don't entirely understand about the GMP problem. > I understand that there are some limitations on GHC's ability to > generate relocatable (and therefore dynamically linkable) code on x86 > (a register allocation problem relat

Re: Replacement for GMP: Update

2006-08-10 Thread Reilly Hayes
There's one thing I don't entirely understand about the GMP problem.  I understand that there are some limitations on GHC's ability to generate relocatable (and therefore dynamically linkable) code on x86 (a register allocation problem related to the mangler if I recall the comments in the code cor

Re: Replacement for GMP: Update

2006-08-10 Thread Peter Tanski
Thorkil, I would like to mention a few things that I have not seen discussed: Clearly, using an existing library unmodified would be preferable: New developments, error corrections, documentation, wide exposure, all of these things would be available. Agreed. Unfortunately for us it see

Re: Replacement for GMP: Update

2006-08-10 Thread Thorkil Naur
Hello, On Thursday 10 August 2006 07:31, Peter Tanski wrote: ... > Summary: I finally settled on modifying OpenSSL, since that would be ... Being a heavy user of Haskell Integers, I have followed this development with great interest. Although your decision has its drawbacks, it could very well

Re: Replacement for GMP: Update

2006-08-10 Thread Peter Tanski
Einar, *"This product includes software developed by the OpenSSL Project *for use in the OpenSSL Toolkit (http://www.openssl.org/)". All developers would have to do is include the acknowledgment stated above. I think this is not bad for specific applications, but forcing this upon all

Re: Replacement for GMP: Update

2006-08-10 Thread Einar Karttunen
On 10.08 11:16, Peter Tanski wrote: > Paragraph 6 of the OpenSSL (1998-2005) license states that: > > * 6. Redistributions of any form whatsoever must retain the following > *acknowledgment: > *"This product includes software developed by the OpenSSL Project > *for use in the OpenSSL

Re: Replacement for GMP: Update

2006-08-10 Thread Peter Tanski
Einar, In my previous email I wrote something potentially confusing (really a typo): For developers (commercial or open source), the OpenSSL license only mentions redistribution of the OpenSSL code in binary form (paragraph 2). In this context "binary form" means the complete program

Re: Replacement for GMP: Update

2006-08-10 Thread Peter Tanski
Einar, Summary: I finally settled on modifying OpenSSL, since that would be the easiest to work with under GHC's hood (plain C code, not C++). I have to: Does this cause license problems? I think OpenSSL license had the advertising clause which means problems if Haskell programs want to link

Re: Replacement for GMP: Update

2006-08-10 Thread Peter Tanski
Remember that the memory-allocation mechanism is crucial. How does BN do that? BN uses a structure called "CTX"--OpenSSL calls all such structures "CTX"--to hold the local static variables for reentrancy. CTX structures do not affect memory allocation, though they *do* require malloc'd m

Re: Replacement for GMP: Update

2006-08-10 Thread Peter Tanski
Simon, Possibly, yes. IIRC, -O3 was mainly to get some loop unrolling. This is a performance-critical part of the system though, and when making any changes we like to measure things to make sure we haven't pessimised performance. I will try to test it both ways, then. Also, -optc-O3 is

RE: Replacement for GMP: Update

2006-08-10 Thread Simon Marlow
On 10 August 2006 06:32, Peter Tanski wrote: > for the Makefile in ghc/rts, in lines 300-346, > GC_HC_OPTS += -optc-O3 > --isn't this problematic? gcc, from -O2 on includes -fgcse which > may *reduce* runtime performance in programs using

RE: Replacement for GMP: Update

2006-08-10 Thread Simon Peyton-Jones
; Esa Ilari Vuokko; John Meacham | Cc: glasgow-haskell-users@haskell.org | Subject: Replacement for GMP: Update | | Simon PJ, Simon, Esa and John, | | Here is an update on what I have been doing so far in making a grand | attempt to replace GMP. | | (1) evaluate replacement libraries

Replacement for GMP: Update

2006-08-09 Thread Peter Tanski
Simon PJ, Simon, Esa and John, Here is an update on what I have been doing so far in making a grand attempt to replace GMP. (1) evaluate replacement libraries LibTomMath: Pros- * has all the operators GMP offered Cons- *