[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Procedural equivalence: the last debate



John Cowan wrote:

> There is no need to test the safe cases, only the unsafe ones.  Assuming
> that characters and fixnums are immediate, as in most high-performance
> Schemes, all you need is this:
> 
> (define (eqv? x)
>   (if (eq? x)
>     #t
>     (if (and (not (fixnum? x)) (number? x))
>       (numeric-eqv? x)
>       #f))

That's unlikely to be any faster than what I proposed.  The number? predicate
probably involves on the order of five separate type tests (fixnum, bignum,
ratnum, flonum, compnum).  In Larceny, four of those five type tests are full
type tests, so the number of machine instructions inlined would be greater
than for what I proposed, and the performance would be worse.

Instead of guessing about what implementors could do, let's look at what
implementors have done.  Here's a small start, using the benchmarks I
posted previously, with all timings done on my 6-year-old (not 4-year-old,
as I wrote earlier) MacBook Pro:

                 eq?         eqv?

Larceny           .4          2.2
Ikarus            .4          2.1
Racket           1.2          3.1
ypsilon          4.5          6.5

Will

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports