Skip to content

Instantly share code, notes, and snippets.

(define a -1)
(define b 1)
;; original
(define x ((λ ()
(let ([l '()])
(define (loop i)
(if (< i b)
(begin (append (loop (+ i 1/100)) (list i)))
(append l (list i))))
@takikawa
takikawa / bench.rkt
Created November 9, 2012 15:52 — forked from greghendershott/bench.rkt
Why is a simple contract so much slower than a check?
#lang racket
(define (f/raw x)
#t)
(define (f/checked x)
(unless (exact-nonnegative-integer? x)
(error 'f/checked "blah blah"))
#t)
#lang racket
(require (for-syntax syntax/parse
syntax/parse/experimental/template
racket/syntax
racket/list))
;; A syntax class to recognize function arguments:
(begin-for-syntax
(define-splicing-syntax-class argspec
(;; random ID
0 187
;; QR Opcode AA TC RD RA Z RCODE
;; 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0
129 128
;; QDCOUNT
0 1
;; ANSCOUNT
0 1
;; NSCOUNT