[racket] (Math) Computing the mean is slow in Typed Racket

From: Laurent (laurent.orseau at gmail.com)
Date: Fri Feb 8 05:19:55 EST 2013

On Fri, Feb 8, 2013 at 10:56 AM, Jens Axel Søgaard
<jensaxel at soegaard.net>wrote:

> Try
>            [xs  (if (list? xs) xs (sequence->list xs))])
> and see what the new timings are.
>

Perfect! I'm glad it was so simple.

old mean:
cpu time: 3621 real time: 3621 gc time: 2613
494936207/10000000

new mean:
cpu time: 564 real time: 563 gc time: 0
494936207/10000000

my-mean:
cpu time: 512 real time: 515 gc time: 132
494936207/10000000

Had to explicitely cast xs to a list of reals:
(cast (if (list? xs) xs (sequence->list xs))
      (Listof Real))

But shouldn't this patch be applied directly to sequence->list instead?

Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130208/c894d0de/attachment.html>

Posted on the users mailing list.