Re: Int vs Integer

1998-09-14 Thread Hans Aberg
>It might be worthy to point out that the both ideas have been >implemented in Smalltalk for ages. I think this is just a standard technique to speed up small objects a little. Dynamic languages often distinguishes between "unboxed" and "boxed" elements; I think the latter is the one that has a

Re: Int vs Integer

1998-09-14 Thread Stefan Monnier
> "Jan" == Jan Skibinski <[EMAIL PROTECTED]> writes: > One of the myths was that Smalltalk was notoriously slow for > math. I checked this last time four years ago in a context > of comparative tests between Smalltalk and Eiffel interpreter Speed comparison of interpreters is pretty much poin

Re: Int vs Integer

1998-09-14 Thread Jan Skibinski
> > >Plus "double dispatching" for > >mixed type arithmetic. > > I use a variation of "double dispatch" myself (in a C++ program I wrote) > where one can return function pointers as a replacement for the function > returning it. > > But I do not think "double dispatch" has anything to do

Re: Int vs Integer

1998-09-14 Thread Hans Aberg
At 11:14 +0400 98/09/14, S.D.Mechveliani wrote: >Here is some simple benchmark for Int vs Integer performance. > >In the system i use, it gives the time ratio Integer/Int >(for the whole task) = 4.5. At 23:13 +0100 98/09/13, Simon Marlow wrote: >The plan is to use something like > > dat

Re: Int vs Integer

1998-09-14 Thread Felix Schroeter
Hello! On Sun, Sep 13, 1998 at 11:13:35PM +0100, Simon Marlow wrote: > [...] > The plan is to use something like > data Integer = Small Int# | Big { ... } > where '...' is the GMP representation. You then need a full set of > [...] Sounds fine. Just a question, will there remain an Int

Re: Int vs Integer

1998-09-14 Thread Sigbjorn Finne
Felix Schroeter writes: > Hello! > > On Sun, Sep 13, 1998 at 11:13:35PM +0100, Simon Marlow wrote: > > [...] > > > The plan is to use something like > > > data Integer = Small Int# | Big { ... } > > > where '...' is the GMP representation. You then need a full set of > > [...] > > Soun

Re: Int vs Integer

1998-09-14 Thread Jon . Fairbairn
On 13 Sep, Simon Marlow wrote: > The common case of applying a dyadic operation to small Integers would > then be pretty close in performance to that of Int (a couple of > indirect jumps, and a test/branch for the overflow detection, to be > precise). Now that's more like what I had in mind. Isn

Int vs Integer benchmark

1998-09-14 Thread S.D.Mechveliani
Here is some simple benchmark for Int vs Integer performance. In the system i use, it gives the time ratio Integer/Int (for the whole task) = 4.5. The difference is obtained only by switching Z = Integer, Int. -- Sergey Mechveliani [EMAIL PROTECTED] ---

Re: Int vs Integer

1998-09-14 Thread Jan Skibinski
> At 23:13 +0100 98/09/13, Simon Marlow wrote: > >The plan is to use something like > > > > data Integer = Small Int# | Big { ... } > The real difficulty to upper the Integer/Int ratio of 4.5 for integers > fitting into a word is to minimize those overflow checks. So this part > should b

heap exhausted

1998-09-14 Thread Martin Stein
Hi, though I think there was written enough about this theme, I can't still understand the following problem (foldl' from the Prelude.hs): > seq1 x = (3-x):seq1 x > seq2 x = (3-x):seq2 1 > > countOne xs = foldl' (\c x -> if x==1 then c+1 else c) 0 xs > > num1 n = countOne (take n (seq1 1)) > num