[racket] Untyped arithmetics performance

From: Xiangqi Li (artlessu at gmail.com)
Date: Mon Jan 26 13:22:06 EST 2015

For the testing program provided by Matthew, we can also use *(timeline v)*
(an enhanced version of displayln) to compare the value of v at each
iteration and see the results in a better way:


​If you want to try it out yourself, you can go to
https://github.com/lixiangqi/medic and install the Medic package which has
support for timeline. By writing the following Medic program,

#lang medic

(layer layer1
       (in #:module "src.rkt"
           [(at (+ v (/ x 100))) [on-entry (timeline v)]]
           [(at  (+ v (/ x (- 100 x)))) [on-entry (timeline v)]]))

you'll see a timeline view of results.

Xiangqi

On Sat, Jan 24, 2015 at 09:56 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:

>
> Jens Axel and Alexander have provided the answer, but in case it helps
> to see what they mean, try these loops that display the intermediate
> results:
>
>  (for/fold ([v 0]) ([x (in-range 100)])
>    (displayln v)
>    (+ v (/ x 100)))
>
>  (for/fold ([v 0]) ([x (in-range 100)])
>    (displayln v)
>    (+ v (/ x (- 100 x))))
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20150126/7034e601/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: timeline.png
Type: image/png
Size: 15011 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20150126/7034e601/attachment.png>

Posted on the users mailing list.