[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] Procedural equivalence: the last debate
- To: <will@x>, "John Cowan" <cowan@x>
- Subject: Re: [Scheme-reports] Procedural equivalence: the last debate
- From: <xacc.ide@x>
- Date: Thu, 6 Jun 2013 19:39:43 +0200
- Cc: scheme-reports <scheme-reports@x>
- Importance: Normal
- In-reply-to: <16819974.2330461370532298377.JavaMail.root@zimbra>
- References: <16819974.2330461370532298377.JavaMail.root@zimbra>
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