Created
April 18, 2026 21:43
-
-
Save countvajhula/3add55052673f3084415a23959a6b22b to your computer and use it in GitHub Desktop.
vlibench report racket/qi-list/pacman
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 scribble/manual | |
| @require[scribble-math/dollar | |
| srfi/19 | |
| vlibench | |
| (for-syntax racket/base) | |
| racket/cmdline | |
| racket/string | |
| racket/function] | |
| @;Command-line handling ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| @(define config-profile | |
| (let () | |
| (define profile-box (box 'preview)) | |
| (command-line | |
| #:once-each | |
| (("-p" "--profile") | |
| name | |
| "profile name to use (use 'list' to list available profiles)" | |
| (when (equal? name "list") | |
| (displayln | |
| (format | |
| "Available profiles: ~a" | |
| (string-join | |
| (for/list (((k v) vlib/profiles)) | |
| (symbol->string k)) | |
| ", "))) | |
| (exit 0)) | |
| (set-box! profile-box (string->symbol name)))) | |
| (unbox profile-box))) | |
| @title[#:style (with-html5 manual-doc-style)]{Racket Normal/CPS Streams Competitive Benchmarks} | |
| @;Qi version helper ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| @(begin-for-syntax | |
| (require setup/getinfo) | |
| (define (get-version) | |
| ((get-info '("qi")) 'version))) | |
| @(define-syntax (get-qi-version stx) | |
| (datum->syntax stx (get-version) stx stx)) | |
| @;Specification ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| @(module racket-default racket/base | |
| (require racket/math | |
| racket/list | |
| vlibench) | |
| (provide racket-range-filter-map-prog | |
| ) | |
| (define impl-label "Racket") | |
| (define racket-range-filter-map-prog | |
| (make-vlib/prog impl-label | |
| (λ (high) (map sqr (filter odd? (range high)))))) | |
| ) | |
| @(module qi-list racket/base | |
| (require qi | |
| qi/list | |
| racket/math | |
| racket/list | |
| vlibench) | |
| (provide qi-list-range-filter-map-prog | |
| ) | |
| (define impl-label "Qi/List") | |
| (define qi-list-range-filter-map-prog | |
| (make-vlib/prog impl-label | |
| (λ (high) (~> () (range high) (filter odd?) (map sqr))))) | |
| ) | |
| @(module pacman racket/base | |
| (require racket/math | |
| (prefix-in cps: | |
| "../../raqit/basic-cps-streams/scratch.rkt") | |
| vlibench) | |
| (provide pacman-range-filter-map-prog | |
| ) | |
| (define impl-label "Pacman") | |
| (define pacman-range-filter-map-prog | |
| (make-vlib/prog impl-label | |
| (λ (high) | |
| ((cps:stream→list | |
| (cps:map sqr | |
| (cps:filter odd? | |
| cps:range))) | |
| (list 0 high 1))))) | |
| ) | |
| @(require 'qi-list | |
| 'racket-default | |
| 'pacman) | |
| @(define benchmarks-specs | |
| (list | |
| (vlib/spec 'range-filter-map | |
| identity | |
| (list racket-range-filter-map-prog | |
| pacman-range-filter-map-prog | |
| qi-list-range-filter-map-prog)) | |
| )) | |
| @; Processing ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| @define[profile (hash-ref vlib/profiles config-profile)] | |
| @(define results | |
| (for/list ((spec (in-list benchmarks-specs))) | |
| (run-benchmark | |
| spec | |
| #:profile profile))) | |
| @; Rendering ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| @section{General Information} | |
| Date and time: @(date->string (seconds->date (current-seconds))) | |
| @snippet:vlib/profile[profile] | |
| @snippet:system-information[#:more-versions `(("Qi Version: " ,(get-qi-version)))] | |
| @section{Summary Results} | |
| @snippet:summary-results-table[results] | |
| @section{Detailed Results} | |
| @snippet:benchmark/s-duration[results] | |
| Measured lengths: @(racket #,(for/list ((len (vlib/profile->steps profile))) len)) | |
| @(for/list ((result (in-list results))) | |
| (snippet:benchmark-result result)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment