Paul Moore wrote:
2009/8/5 Yitzchak Gale :
Or is this with an alternate RNG? Although I think even that
would be fair, since Python uses Mersenne.
I got the impression Dmitry was using Haskell's standard RNG, not
Mersenne Twister. If so, then we'd get further improvements with MT,
but that's s
> I got the impression Dmitry was using Haskell's standard RNG, not
> Mersenne Twister. If so, then we'd get further improvements with MT,
> but that's still a hit against Haskell, as I'd interpret it as meaning
> that Haskell supplies as default a PRNG which costs noticeable
> performance in order
2009/8/5 Yitzchak Gale :
> Dmitry Olshansky wrote:
>> My measurements show that...
>> (-O2 gives approx 2 time impovements).
>> ...using RandomGen and State monad to generate a list gives at least 4 times
>> improvements (on 1 000 000 items).
>
> You earlier said:
>
>> this takes over twice as long
Dmitry Olshansky wrote:
> My measurements show that...
> (-O2 gives approx 2 time impovements).
> ...using RandomGen and State monad to generate a list gives at least 4 times
> improvements (on 1 000 000 items).
You earlier said:
> this takes over twice as long as a naively implemented
Python pro
My measurements show that
- using strict version of insertWith doesn't improve performance. - in case
of compilation with -O2 flag foldl' also is equal to foldl (-O2 gives approx
2 time impovements).- using RandomGen and State monad to generate a list
gives at least 4 times improvements (on 1 000 0
Am Samstag 01 August 2009 20:50:10 schrieb Sterling Clover:
> On Aug 1, 2009, at 2:06 PM, Paul Moore wrote:
> > Is the issue with random numbers just the implementation, or is it
> > something inherent in the non-pure nature of a random number generator
> > that makes it hard for Haskell to impleme
Sterling Clover wrote:
For other random numbers, with different properties (faster, but with
tradeoffs in robustness, or ability to split, or both), you can check
hackage for at least mersenne-random and gsl-random.
gsl-random is definitely worth a try for performance. I recently did a
rough
On Aug 1, 2009, at 2:06 PM, Paul Moore wrote:
Is the issue with random numbers just the implementation, or is it
something inherent in the non-pure nature of a random number generator
that makes it hard for Haskell to implement efficiently? If the
latter, that probably makes Haskell a somewhat
Am Samstag 01 August 2009 15:44:39 schrieb Paul Moore:
> 2009/7/31 Paul Moore :
> > 2009/7/31 Gregory Collins :
>
> Hmm, I'm obviously still mucking up the performance somehow. My full
> program (still a toy, but a step on the way to what I'm aiming at) is
> as follows. It's rolling 3 6-sided dice
I'm expecting the answer to be that I've got unnecessary laziness -
which
is fine, but ultimately my interest is in ease of expression and
performance combined, so I'm looking for beginner-level improvements
rather than subtle advanced techniques like unboxing.
You're right, it is too lazy. H
2009/8/1 Ketil Malde :
> Paul Moore writes:
>
>> What am I doing wrong here? I'd have expected compiled Haskell to be
>> faster than interpreted Python, so obviously my approach is wrong.
>
> Two things from my experience: Python associative arrays are fast, and
> Haskell random numbers are slow.
Paul Moore writes:
> What am I doing wrong here? I'd have expected compiled Haskell to be
> faster than interpreted Python, so obviously my approach is wrong.
Two things from my experience: Python associative arrays are fast, and
Haskell random numbers are slow. So by building a map from random
On Sat, Aug 1, 2009 at 4:44 PM, Paul Moore wrote:
> PS I know my code is probably fairly clumsy - I'd appreciate style
> suggestions, but my main interest here is whether a beginner, with a
> broad programming background, a basic understanding of Haskell, and
> access to Google, put together a clea
2009/7/31 Paul Moore :
> 2009/7/31 Gregory Collins :
>> Paul Moore writes:
>>
>>> How would I efficiently write a function in Haskell to count
>>> occurrences of unique elements in a (potentially very large) list? For
>>> example, given the list [1,2,3,4,5,3,4,2,4] I would like the output
>>> [[1,
2009/8/1 Paul Moore :
> BTW, I did know that Haskell had an efficient map implementation, I
> just wasn't sure how to use it "functionally" - I probably should have
> searched a bit harder for examples before posting. Thanks for the help
> in any case.
Know that Data.Map uses size balanced trees a
2009/7/31 Gregory Collins :
> Paul Moore writes:
>
>> How would I efficiently write a function in Haskell to count
>> occurrences of unique elements in a (potentially very large) list? For
>> example, given the list [1,2,3,4,5,3,4,2,4] I would like the output
>> [[1,1], [2,2], [3,2], [4,3], [5,1]]
Am Freitag 31 Juli 2009 22:39:53 schrieb Paul Moore:
> How would I efficiently write a function in Haskell to count
> occurrences of unique elements in a (potentially very large) list? For
> example, given the list [1,2,3,4,5,3,4,2,4] I would like the output
> [[1,1], [2,2], [3,2], [4,3], [5,1]] (o
In an imperative language like Python, I'd use a dictionary as an
accumulator - something like
for el in input:
accums[i] = accums.get(i, 0) + 1
Haskell has efficient dictionary structures too, e.g. Data.Map
List.foldl' (\m x-> Map.insertWith' (+) x 1 m) Map.empty
Regards,
Mal
Gregory Collins writes:
> Paul Moore writes:
>
>> How would I efficiently write a function in Haskell to count
>> occurrences of unique elements in a (potentially very large) list? For
>> example, given the list [1,2,3,4,5,3,4,2,4] I would like the output
>> [[1,1], [2,2], [3,2], [4,3], [5,1]] (
Paul Moore writes:
> How would I efficiently write a function in Haskell to count
> occurrences of unique elements in a (potentially very large) list? For
> example, given the list [1,2,3,4,5,3,4,2,4] I would like the output
> [[1,1], [2,2], [3,2], [4,3], [5,1]] (or some equivalent
> representati
How would I efficiently write a function in Haskell to count
occurrences of unique elements in a (potentially very large) list? For
example, given the list [1,2,3,4,5,3,4,2,4] I would like the output
[[1,1], [2,2], [3,2], [4,3], [5,1]] (or some equivalent
representation).
Clearly, this won't be po
21 matches
Mail list logo