precfunc
, tristream
, and
wordstream
implementations of xreal
. I
updated the testing and timing utilities from last year to work with
MZScheme in the definitions file progutils-3.scm
on the
resources page.
time
displays run time, garbage-collection time, and real
time to evaluate a given expression. timetest
lets you
list time tests in files to be processed with
progtest
.time
to get an idea of how it
works, and how the timings can vary due to invisible influences. You
might find the following spin
procedure useful for trying
out time
(define (spin n)
(cond ((= n 0) '())
(else (spin (- n 1)))))
precfunc
vs. tristream
vs. wordstream
. You may have to work a bit to come up
with computations that are large enough to get meaningful numbers from
time
. Try to make the examples get at the heart of
the structural effects that determine efficiency for each
implementation. precfunc
is vulnerable to waste from
generating rationals that are unnecessarily complex, and from
repeating computations unnecessarily. tristream
is
vulnerable to waste because it treats numbers approximately one bit at
a time. wordstream
performs sensible sized operations on
integers, but it is vulnerable to requiring far more precision than
necessary from intermediate steps, since the need for one more bit can
create the demand for a whole word.timetest
from
progutils-3.scm
or test code of your own if you like it
better.README.txt
containing very
short and simple instructions how to execute your tests. If
this takes more than 2 lines, you probably need to write a
Scheme file to automate things more for the
grader.comments.txt
, or a variant in
another format, containing a discussion of your observations.
![]() | |