www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

test-performance.rkt (632B)


      1 #lang racket
      2 
      3 (require subtemplate/override)
      4 
      5 (time
      6  (syntax-case #'((((0 1 2 3 4 5 6 7 8 9)))) ()
      7    [((((a b c d e f g h i j) …) …) …)
      8     #'(a … … …)]))
      9 
     10 (time
     11  (syntax-case #'((((0 1 2 3 4 5 6 7 8 9)))) ()
     12    [((((a b c d e f g h i j) …) …) …)
     13     (list #'a … … …)]))
     14 
     15 ;; raco expand this-file.rkt | wc
     16 ;; shows that there are 160 extra words for each additional level of nesting
     17 ;; for the following code, between 2 and 5 (inclusive) levels of nesting.
     18 (time
     19  (syntax-case #'((((((0 1 2 3 4 5 6 7 8 9)))))) ()
     20    [((((((a b c d e f g h i j) …) …) …) …) …)
     21     (list #'a … … … … …)]))