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

(Just a little testing of the exciting new math lib.)
Is it currently normal that computing the mean of a big list is 10x slower
compared to the (/ (apply + l) (length l)) method?
The math lib is very recent so I'm not entirely surprised, anyway. Most of
the time seems to be due to GC.
E.g. (on command line Racket) :
#lang typed/racket
(require math)
(: n Integer)
(define n 10000000)
(: l (Listof Integer))
(define l (build-list n (λ(x)(random 100))))
(: my-mean ((Listof Integer) -> Number))
(define (my-mean l)
(/ (apply + l) (length l)))
(time (mean l))
(time (my-mean l))
-->
cpu time: 3932 real time: 3931 gc time: 2848
495033609/10000000
cpu time: 408 real time: 406 gc time: 4
495033609/10000000
Cheers,
Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130208/3960abd9/attachment.html>