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

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



Due to the lack of type inference and dumb handling in the IronScheme REPL, 
here is my apples to apples comparison:

> (library (foo)
.   (export cowan-test-eq cowan-test-eqv)
.   (import
.     (except (rnrs) - =)
.     (rename (ironscheme unsafe) ($fx- -) ($fx=? =))
.     (ironscheme typed))
.   (define: (cowan-test-eq (n : fixnum) x y)
.     (cond ((eq? x y) 'done)
.           ((= n 0)
.            (cowan-test-eq n 'a 'a))
.           (else
.            (cowan-test-eq (- n 1) x y))))
.   (define: (cowan-test-eqv (n : fixnum) x y)
.     (cond ((eqv? x y) 'done)
.           ((= n 0)
.            (cowan-test-eqv n 'a 'a))
.           (else
.            (cowan-test-eqv (- n 1) x y)))))
> (import (foo))
> (time (cowan-test-eq 100000000 'a 'b))
Statistics for '(cowan-test-eq 100000000 'a 'b)':
  Real Time:  67ms
  CPU Time:   62ms
  User Time:  62ms
  GC's:       0
done
> (time (cowan-test-eqv 100000000 'a 'b))
Statistics for '(cowan-test-eqv 100000000 'a 'b)':
  Real Time:  1222ms
  CPU Time:   1217ms
  User Time:  1217ms
  GC's:       0
done

On a 4.5Ghz i7.

eq? simply tests for pointer (reference) equality, eqv? calls .NET's 
object.Equals(object, object). It makes no difference if I add a fast path 
for testing pointer equality in eqv?.

Without the type hints, = and - takes up most of the time and the times are 
in the tens of seconds :(

Cheers

leppie


-----Original Message----- 

                 eq?         eqv?

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




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