Created
September 3, 2022 00:28
-
-
Save mflatt/887034c62172c266584492279854ad33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket/base | |
(define (f a) '()) | |
(define (f0 a b c x) '()) | |
(define (f1 a b c x #:y [y 'y]) '()) | |
(define (f2 a b c x #:y y) '()) | |
(define (identity x) x) | |
(define-syntax-rule (time-it wrap ...) | |
(begin | |
(begin (display 'wrap) (display " ")) ... | |
(newline) | |
(for ([f (in-list (list f))]) | |
(displayln (object-name f)) | |
(time | |
(for ([i (in-range 1000000)]) | |
(for ([C (in-list (list compose compose1))]) | |
(C wrap ... f)))) | |
(time | |
(for ([C (in-list (list compose compose1))]) | |
(let ([f (C wrap ... f)]) | |
(for ([i (in-range 1000000)]) | |
(f 'a))))) | |
(newline)) | |
(for ([f (in-list (list f0 f1))]) | |
(displayln (object-name f)) | |
(time | |
(for ([i (in-range 1000000)]) | |
(for ([C (in-list (list compose compose1))]) | |
(C wrap ... f)))) | |
(time | |
(for ([C (in-list (list compose compose1))]) | |
(let ([f (C wrap ... f)]) | |
(for ([i (in-range 1000000)]) | |
(f 'a 'b 'c 'x))))) | |
(newline)) | |
(displayln (object-name f2)) | |
(time | |
(for ([i (in-range 1000000)]) | |
(for ([C (in-list (list compose compose1))]) | |
(C wrap ... f2)))) | |
(time | |
(for ([C (in-list (list compose compose1))]) | |
(let ([f (C wrap ... f2)]) | |
(for ([i (in-range 1000000)]) | |
(f 'a 'b 'c 'x #:y 'y))))) | |
(newline))) | |
(time-it identity) | |
(time-it list list list list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment