{ "schema_version": 3, "suite": "mock-window-manager-v1", "seed_values": [ 0, 1, 2, 3 ], "cases": [ { "name": "wm-callback-chain", "category": "calls", "definitions": ";; A deterministic headless WM. Clients are [id workspace x y width height flags].\n;; State is [clients focus workspace ticks commands geometry managed config hooks seed].\n(define wm-modulus 1000000007)\n(define wm-config-generation 0)\n(define wm-active-keys '())\n(define wm-loaded-policy (lambda (s id) #f))\n\n(define (wm-new seed)\n (let ((clients (make-vector 64 #f)))\n (let loop ((id 0))\n (if (< id 64)\n (begin (vector-set! clients id (vector id (modulo id 4) 0 0 0 0 1))\n (loop (+ id 1)))))\n (vector clients (modulo seed 64) (modulo seed 4) 0 0 0 64 0 0 seed)))\n\n(define (wm-command s id code)\n (vector-set! s 4 (modulo (+ (* (vector-ref s 4) 17) (* id 3) code) wm-modulus))\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client (vector-set! client 6 (modulo (+ (vector-ref client 6) code) 256))))\n code)\n\n(define (wm-focus s start)\n (let ((clients (vector-ref s 0)) (workspace (vector-ref s 2)))\n (let loop ((left 64) (id (modulo start 64)))\n (if (= left 0) (vector-set! s 1 -1)\n (let ((client (vector-ref clients id)))\n (if (and client (= (vector-ref client 1) workspace)) (vector-set! s 1 id)\n (loop (- left 1) (modulo (+ id 1) 64))))))))\n\n(define (wm-switch s workspace)\n (vector-set! s 2 (modulo workspace 4))\n (wm-focus s (+ (vector-ref s 1) 1)))\n\n(define (wm-move s id workspace)\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client\n (begin (vector-set! client 1 (modulo workspace 4))\n (if (and (= id (vector-ref s 1)) (not (= (vector-ref client 1) (vector-ref s 2))))\n (wm-focus s (+ id 1))))))\n (wm-command s id 3))\n\n(define (wm-map s id workspace)\n (let ((clients (vector-ref s 0)))\n (if (not (vector-ref clients id)) (vector-set! s 6 (+ 1 (vector-ref s 6))))\n (vector-set! clients id (vector id (modulo workspace 4) 0 0 0 0 1))))\n\n(define (wm-unmap s id)\n (let ((clients (vector-ref s 0)))\n (if (vector-ref clients id)\n (begin (vector-set! clients id #f) (vector-set! s 6 (- (vector-ref s 6) 1)))))\n (if (= id (vector-ref s 1)) (wm-focus s (+ id 1))))\n\n(define (wm-layout s frame)\n (let* ((clients (vector-ref s 0)) (workspace (vector-ref s 2))\n (width (+ 1280 (* 8 (vector-ref s 9)))) (gap (+ 4 (modulo (vector-ref s 7) 5)))\n (master (quotient (* width 3) 5))\n (count (let scan ((id 0) (n 0))\n (if (= id 64) n\n (let ((c (vector-ref clients id)))\n (scan (+ id 1) (if (and c (= (vector-ref c 1) workspace)) (+ n 1) n)))))))\n (let place ((id 0) (rank 0))\n (if (< id 64)\n (let ((c (vector-ref clients id)))\n (if (and c (= (vector-ref c 1) workspace))\n (begin\n (if (or (= count 1) (= (modulo frame 2) 1))\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- width (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (if (= rank 0)\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- master (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (let ((height (quotient 720 (- count 1))))\n (vector-set! c 2 (+ master gap)) (vector-set! c 3 (+ gap (* (- rank 1) height)))\n (vector-set! c 4 (- width master (* 2 gap))) (vector-set! c 5 (- height (* 2 gap))))))\n (place (+ id 1) (+ rank 1)))\n (place (+ id 1) rank)))))\n (vector-set! s 5 (modulo (+ (vector-ref s 5) (* count 97) frame) wm-modulus))))\n\n(define wm-dispatch\n (vector (lambda(s id p)(wm-focus s id)) (lambda(s id p)(wm-switch s p))\n (lambda(s id p)(wm-move s id p)) (lambda(s id p)(wm-command s id p))\n (lambda(s id p)(wm-layout s p)) (lambda(s id p)(wm-map s id p))\n (lambda(s id p)(wm-unmap s id))\n (lambda(s id p)(vector-set! s 8 (+ (vector-ref s 8) p)))))\n\n(define (wm-event s kind id payload)\n (vector-set! s 3 (+ (vector-ref s 3) 1))\n ((vector-ref wm-dispatch kind) s id payload))\n\n(define (wm-leaf s id code) (wm-command s id code) (+ code 1))\n(define (wm-one s id code) (wm-leaf s id (+ code 1)))\n(define (wm-two s id code) (wm-one s id (+ code 1)))\n(define (wm-three s id code) (wm-two s id (+ code 1)))\n(define (wm-four s id code) (wm-three s id (+ code 1)))\n(define (wm-callback bias) (lambda(s id code)(wm-four s id (+ code bias))))\n(define (wm-invoke callback s id code) (callback s id code))\n\n(define-syntax wm-binding\n (syntax-rules () ((_ key modifiers action) (cons (cons key modifiers) action))))\n(define-syntax wm-keyset\n (syntax-rules () ((_ (key modifiers code) ...)\n (list (wm-binding key modifiers (wm-action code)) ...))))\n(define (wm-action code) (lambda(s id)(wm-command s id code)))\n(define (wm-keymap bias)\n (let loop ((id 31) (keys '()))\n (if (< id 0) keys\n (loop (- id 1) (cons (wm-binding (modulo id 8) (quotient id 8)\n (wm-action (+ (* (+ id 1) 3) bias))) keys)))))\n(define (wm-key s keys key modifiers id)\n (let ((binding (assoc (cons key modifiers) keys)))\n (if binding ((cdr binding) s id))))\n\n(define (wm-hook tag)\n (let ((count 0))\n (lambda(s id code)\n (set! count (+ count 1))\n (wm-command s id (+ tag code count))\n (vector-set! s 8 (+ (vector-ref s 8) count))\n (= (modulo code (+ tag 2)) 0))))\n(define (wm-deliver hooks s id code)\n (if (pair? hooks)\n (if (not ((car hooks) s id code)) (wm-deliver (cdr hooks) s id code))))\n\n(define (wm-macro-form bias)\n (cons 'wm-keyset\n (let loop ((id 31) (forms '()))\n (if (< id 0) forms\n (loop (- id 1) (cons (list (modulo id 8) (quotient id 8) (+ (* (+ id 1) 3) bias)) forms))))))\n(define (wm-load-config)\n (load (string-append wm-fixture-root \"/root.scm\")))\n(define (wm-apply-config s id)\n (vector-set! s 7 wm-config-generation)\n (wm-loaded-policy s id)\n (wm-key s wm-active-keys (modulo id 8) (modulo (quotient id 8) 4) id))\n\n(define (wm-score s)\n (let ((initial (let state ((i 1) (hash 19))\n (if (= i 10) hash (state (+ i 1) (modulo (+ (* hash 33) (vector-ref s i)) wm-modulus))))))\n (let clients ((id 0) (hash initial))\n (if (= id 64) hash\n (let ((c (vector-ref (vector-ref s 0) id)))\n (clients (+ id 1)\n (if c\n (let fields ((i 0) (h hash))\n (if (= i 7) h (fields (+ i 1) (modulo (+ (* h 33) (vector-ref c i)) wm-modulus))))\n (modulo (+ (* hash 33) 257) wm-modulus))))))))\n\n(define (benchmark seed)\n (let ((s (wm-new seed)) (callback (wm-callback seed)))\n \n (let loop ((i 0))\n (if (< i (+ 4096 (* 8 seed))) (begin (wm-invoke callback s (modulo (+ (* i 13) seed) 64) (modulo i 31)) (loop (+ i 1)))))\n (wm-score s)))", "expected": 335333945, "expected_by_seed": [ 335333945, 367417536, 846886949, 836297807 ], "batch_calls": 4, "warmup_calls": 5, "source": "bench/wm/wm-callback-chain.scm", "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))", "guile_setup": "(define-module (vile benchmarks wm-callback-chain) #:use-module (guile))\n(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (current-module))", "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.", "source_sha256": "0703fe76b22e55f26da50e5d6aa61a6a51de3f29d9774a380c24178d5d7649c6" }, { "name": "wm-event-dispatch", "category": "events", "definitions": ";; A deterministic headless WM. Clients are [id workspace x y width height flags].\n;; State is [clients focus workspace ticks commands geometry managed config hooks seed].\n(define wm-modulus 1000000007)\n(define wm-config-generation 0)\n(define wm-active-keys '())\n(define wm-loaded-policy (lambda (s id) #f))\n\n(define (wm-new seed)\n (let ((clients (make-vector 64 #f)))\n (let loop ((id 0))\n (if (< id 64)\n (begin (vector-set! clients id (vector id (modulo id 4) 0 0 0 0 1))\n (loop (+ id 1)))))\n (vector clients (modulo seed 64) (modulo seed 4) 0 0 0 64 0 0 seed)))\n\n(define (wm-command s id code)\n (vector-set! s 4 (modulo (+ (* (vector-ref s 4) 17) (* id 3) code) wm-modulus))\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client (vector-set! client 6 (modulo (+ (vector-ref client 6) code) 256))))\n code)\n\n(define (wm-focus s start)\n (let ((clients (vector-ref s 0)) (workspace (vector-ref s 2)))\n (let loop ((left 64) (id (modulo start 64)))\n (if (= left 0) (vector-set! s 1 -1)\n (let ((client (vector-ref clients id)))\n (if (and client (= (vector-ref client 1) workspace)) (vector-set! s 1 id)\n (loop (- left 1) (modulo (+ id 1) 64))))))))\n\n(define (wm-switch s workspace)\n (vector-set! s 2 (modulo workspace 4))\n (wm-focus s (+ (vector-ref s 1) 1)))\n\n(define (wm-move s id workspace)\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client\n (begin (vector-set! client 1 (modulo workspace 4))\n (if (and (= id (vector-ref s 1)) (not (= (vector-ref client 1) (vector-ref s 2))))\n (wm-focus s (+ id 1))))))\n (wm-command s id 3))\n\n(define (wm-map s id workspace)\n (let ((clients (vector-ref s 0)))\n (if (not (vector-ref clients id)) (vector-set! s 6 (+ 1 (vector-ref s 6))))\n (vector-set! clients id (vector id (modulo workspace 4) 0 0 0 0 1))))\n\n(define (wm-unmap s id)\n (let ((clients (vector-ref s 0)))\n (if (vector-ref clients id)\n (begin (vector-set! clients id #f) (vector-set! s 6 (- (vector-ref s 6) 1)))))\n (if (= id (vector-ref s 1)) (wm-focus s (+ id 1))))\n\n(define (wm-layout s frame)\n (let* ((clients (vector-ref s 0)) (workspace (vector-ref s 2))\n (width (+ 1280 (* 8 (vector-ref s 9)))) (gap (+ 4 (modulo (vector-ref s 7) 5)))\n (master (quotient (* width 3) 5))\n (count (let scan ((id 0) (n 0))\n (if (= id 64) n\n (let ((c (vector-ref clients id)))\n (scan (+ id 1) (if (and c (= (vector-ref c 1) workspace)) (+ n 1) n)))))))\n (let place ((id 0) (rank 0))\n (if (< id 64)\n (let ((c (vector-ref clients id)))\n (if (and c (= (vector-ref c 1) workspace))\n (begin\n (if (or (= count 1) (= (modulo frame 2) 1))\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- width (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (if (= rank 0)\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- master (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (let ((height (quotient 720 (- count 1))))\n (vector-set! c 2 (+ master gap)) (vector-set! c 3 (+ gap (* (- rank 1) height)))\n (vector-set! c 4 (- width master (* 2 gap))) (vector-set! c 5 (- height (* 2 gap))))))\n (place (+ id 1) (+ rank 1)))\n (place (+ id 1) rank)))))\n (vector-set! s 5 (modulo (+ (vector-ref s 5) (* count 97) frame) wm-modulus))))\n\n(define wm-dispatch\n (vector (lambda(s id p)(wm-focus s id)) (lambda(s id p)(wm-switch s p))\n (lambda(s id p)(wm-move s id p)) (lambda(s id p)(wm-command s id p))\n (lambda(s id p)(wm-layout s p)) (lambda(s id p)(wm-map s id p))\n (lambda(s id p)(wm-unmap s id))\n (lambda(s id p)(vector-set! s 8 (+ (vector-ref s 8) p)))))\n\n(define (wm-event s kind id payload)\n (vector-set! s 3 (+ (vector-ref s 3) 1))\n ((vector-ref wm-dispatch kind) s id payload))\n\n(define (wm-leaf s id code) (wm-command s id code) (+ code 1))\n(define (wm-one s id code) (wm-leaf s id (+ code 1)))\n(define (wm-two s id code) (wm-one s id (+ code 1)))\n(define (wm-three s id code) (wm-two s id (+ code 1)))\n(define (wm-four s id code) (wm-three s id (+ code 1)))\n(define (wm-callback bias) (lambda(s id code)(wm-four s id (+ code bias))))\n(define (wm-invoke callback s id code) (callback s id code))\n\n(define-syntax wm-binding\n (syntax-rules () ((_ key modifiers action) (cons (cons key modifiers) action))))\n(define-syntax wm-keyset\n (syntax-rules () ((_ (key modifiers code) ...)\n (list (wm-binding key modifiers (wm-action code)) ...))))\n(define (wm-action code) (lambda(s id)(wm-command s id code)))\n(define (wm-keymap bias)\n (let loop ((id 31) (keys '()))\n (if (< id 0) keys\n (loop (- id 1) (cons (wm-binding (modulo id 8) (quotient id 8)\n (wm-action (+ (* (+ id 1) 3) bias))) keys)))))\n(define (wm-key s keys key modifiers id)\n (let ((binding (assoc (cons key modifiers) keys)))\n (if binding ((cdr binding) s id))))\n\n(define (wm-hook tag)\n (let ((count 0))\n (lambda(s id code)\n (set! count (+ count 1))\n (wm-command s id (+ tag code count))\n (vector-set! s 8 (+ (vector-ref s 8) count))\n (= (modulo code (+ tag 2)) 0))))\n(define (wm-deliver hooks s id code)\n (if (pair? hooks)\n (if (not ((car hooks) s id code)) (wm-deliver (cdr hooks) s id code))))\n\n(define (wm-macro-form bias)\n (cons 'wm-keyset\n (let loop ((id 31) (forms '()))\n (if (< id 0) forms\n (loop (- id 1) (cons (list (modulo id 8) (quotient id 8) (+ (* (+ id 1) 3) bias)) forms))))))\n(define (wm-load-config)\n (load (string-append wm-fixture-root \"/root.scm\")))\n(define (wm-apply-config s id)\n (vector-set! s 7 wm-config-generation)\n (wm-loaded-policy s id)\n (wm-key s wm-active-keys (modulo id 8) (modulo (quotient id 8) 4) id))\n\n(define (wm-score s)\n (let ((initial (let state ((i 1) (hash 19))\n (if (= i 10) hash (state (+ i 1) (modulo (+ (* hash 33) (vector-ref s i)) wm-modulus))))))\n (let clients ((id 0) (hash initial))\n (if (= id 64) hash\n (let ((c (vector-ref (vector-ref s 0) id)))\n (clients (+ id 1)\n (if c\n (let fields ((i 0) (h hash))\n (if (= i 7) h (fields (+ i 1) (modulo (+ (* h 33) (vector-ref c i)) wm-modulus))))\n (modulo (+ (* hash 33) 257) wm-modulus))))))))\n\n(define (benchmark seed)\n (let ((s (wm-new seed)) )\n \n (let loop ((i 0))\n (if (< i (+ 512 (* 8 seed))) (begin (wm-event s (modulo (+ (* i 5) seed) 8) (modulo (+ (* i 13) seed) 64) (modulo (+ (* i 7) seed) 97)) (loop (+ i 1)))))\n (wm-score s)))", "expected": 351739486, "expected_by_seed": [ 351739486, 797219635, 357458806, 520751872 ], "batch_calls": 4, "warmup_calls": 5, "source": "bench/wm/wm-event-dispatch.scm", "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))", "guile_setup": "(define-module (vile benchmarks wm-event-dispatch) #:use-module (guile))\n(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (current-module))", "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.", "source_sha256": "4a14634938f45ec524ae328018e0a237e3f6e0200361eff76339e4901e833ffc" }, { "name": "wm-focus-cycle", "category": "state", "definitions": ";; A deterministic headless WM. Clients are [id workspace x y width height flags].\n;; State is [clients focus workspace ticks commands geometry managed config hooks seed].\n(define wm-modulus 1000000007)\n(define wm-config-generation 0)\n(define wm-active-keys '())\n(define wm-loaded-policy (lambda (s id) #f))\n\n(define (wm-new seed)\n (let ((clients (make-vector 64 #f)))\n (let loop ((id 0))\n (if (< id 64)\n (begin (vector-set! clients id (vector id (modulo id 4) 0 0 0 0 1))\n (loop (+ id 1)))))\n (vector clients (modulo seed 64) (modulo seed 4) 0 0 0 64 0 0 seed)))\n\n(define (wm-command s id code)\n (vector-set! s 4 (modulo (+ (* (vector-ref s 4) 17) (* id 3) code) wm-modulus))\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client (vector-set! client 6 (modulo (+ (vector-ref client 6) code) 256))))\n code)\n\n(define (wm-focus s start)\n (let ((clients (vector-ref s 0)) (workspace (vector-ref s 2)))\n (let loop ((left 64) (id (modulo start 64)))\n (if (= left 0) (vector-set! s 1 -1)\n (let ((client (vector-ref clients id)))\n (if (and client (= (vector-ref client 1) workspace)) (vector-set! s 1 id)\n (loop (- left 1) (modulo (+ id 1) 64))))))))\n\n(define (wm-switch s workspace)\n (vector-set! s 2 (modulo workspace 4))\n (wm-focus s (+ (vector-ref s 1) 1)))\n\n(define (wm-move s id workspace)\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client\n (begin (vector-set! client 1 (modulo workspace 4))\n (if (and (= id (vector-ref s 1)) (not (= (vector-ref client 1) (vector-ref s 2))))\n (wm-focus s (+ id 1))))))\n (wm-command s id 3))\n\n(define (wm-map s id workspace)\n (let ((clients (vector-ref s 0)))\n (if (not (vector-ref clients id)) (vector-set! s 6 (+ 1 (vector-ref s 6))))\n (vector-set! clients id (vector id (modulo workspace 4) 0 0 0 0 1))))\n\n(define (wm-unmap s id)\n (let ((clients (vector-ref s 0)))\n (if (vector-ref clients id)\n (begin (vector-set! clients id #f) (vector-set! s 6 (- (vector-ref s 6) 1)))))\n (if (= id (vector-ref s 1)) (wm-focus s (+ id 1))))\n\n(define (wm-layout s frame)\n (let* ((clients (vector-ref s 0)) (workspace (vector-ref s 2))\n (width (+ 1280 (* 8 (vector-ref s 9)))) (gap (+ 4 (modulo (vector-ref s 7) 5)))\n (master (quotient (* width 3) 5))\n (count (let scan ((id 0) (n 0))\n (if (= id 64) n\n (let ((c (vector-ref clients id)))\n (scan (+ id 1) (if (and c (= (vector-ref c 1) workspace)) (+ n 1) n)))))))\n (let place ((id 0) (rank 0))\n (if (< id 64)\n (let ((c (vector-ref clients id)))\n (if (and c (= (vector-ref c 1) workspace))\n (begin\n (if (or (= count 1) (= (modulo frame 2) 1))\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- width (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (if (= rank 0)\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- master (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (let ((height (quotient 720 (- count 1))))\n (vector-set! c 2 (+ master gap)) (vector-set! c 3 (+ gap (* (- rank 1) height)))\n (vector-set! c 4 (- width master (* 2 gap))) (vector-set! c 5 (- height (* 2 gap))))))\n (place (+ id 1) (+ rank 1)))\n (place (+ id 1) rank)))))\n (vector-set! s 5 (modulo (+ (vector-ref s 5) (* count 97) frame) wm-modulus))))\n\n(define wm-dispatch\n (vector (lambda(s id p)(wm-focus s id)) (lambda(s id p)(wm-switch s p))\n (lambda(s id p)(wm-move s id p)) (lambda(s id p)(wm-command s id p))\n (lambda(s id p)(wm-layout s p)) (lambda(s id p)(wm-map s id p))\n (lambda(s id p)(wm-unmap s id))\n (lambda(s id p)(vector-set! s 8 (+ (vector-ref s 8) p)))))\n\n(define (wm-event s kind id payload)\n (vector-set! s 3 (+ (vector-ref s 3) 1))\n ((vector-ref wm-dispatch kind) s id payload))\n\n(define (wm-leaf s id code) (wm-command s id code) (+ code 1))\n(define (wm-one s id code) (wm-leaf s id (+ code 1)))\n(define (wm-two s id code) (wm-one s id (+ code 1)))\n(define (wm-three s id code) (wm-two s id (+ code 1)))\n(define (wm-four s id code) (wm-three s id (+ code 1)))\n(define (wm-callback bias) (lambda(s id code)(wm-four s id (+ code bias))))\n(define (wm-invoke callback s id code) (callback s id code))\n\n(define-syntax wm-binding\n (syntax-rules () ((_ key modifiers action) (cons (cons key modifiers) action))))\n(define-syntax wm-keyset\n (syntax-rules () ((_ (key modifiers code) ...)\n (list (wm-binding key modifiers (wm-action code)) ...))))\n(define (wm-action code) (lambda(s id)(wm-command s id code)))\n(define (wm-keymap bias)\n (let loop ((id 31) (keys '()))\n (if (< id 0) keys\n (loop (- id 1) (cons (wm-binding (modulo id 8) (quotient id 8)\n (wm-action (+ (* (+ id 1) 3) bias))) keys)))))\n(define (wm-key s keys key modifiers id)\n (let ((binding (assoc (cons key modifiers) keys)))\n (if binding ((cdr binding) s id))))\n\n(define (wm-hook tag)\n (let ((count 0))\n (lambda(s id code)\n (set! count (+ count 1))\n (wm-command s id (+ tag code count))\n (vector-set! s 8 (+ (vector-ref s 8) count))\n (= (modulo code (+ tag 2)) 0))))\n(define (wm-deliver hooks s id code)\n (if (pair? hooks)\n (if (not ((car hooks) s id code)) (wm-deliver (cdr hooks) s id code))))\n\n(define (wm-macro-form bias)\n (cons 'wm-keyset\n (let loop ((id 31) (forms '()))\n (if (< id 0) forms\n (loop (- id 1) (cons (list (modulo id 8) (quotient id 8) (+ (* (+ id 1) 3) bias)) forms))))))\n(define (wm-load-config)\n (load (string-append wm-fixture-root \"/root.scm\")))\n(define (wm-apply-config s id)\n (vector-set! s 7 wm-config-generation)\n (wm-loaded-policy s id)\n (wm-key s wm-active-keys (modulo id 8) (modulo (quotient id 8) 4) id))\n\n(define (wm-score s)\n (let ((initial (let state ((i 1) (hash 19))\n (if (= i 10) hash (state (+ i 1) (modulo (+ (* hash 33) (vector-ref s i)) wm-modulus))))))\n (let clients ((id 0) (hash initial))\n (if (= id 64) hash\n (let ((c (vector-ref (vector-ref s 0) id)))\n (clients (+ id 1)\n (if c\n (let fields ((i 0) (h hash))\n (if (= i 7) h (fields (+ i 1) (modulo (+ (* h 33) (vector-ref c i)) wm-modulus))))\n (modulo (+ (* hash 33) 257) wm-modulus))))))))\n\n(define (benchmark seed)\n (let ((s (wm-new seed)) )\n \n (let loop ((i 0))\n (if (< i (+ 2048 (* 8 seed))) (begin (if (= (modulo i 17) 0) (wm-switch s (+ i seed)))\n (wm-focus s (+ (* i 17) seed))\n (wm-command s (if (< (vector-ref s 1) 0) 0 (vector-ref s 1)) 1) (loop (+ i 1)))))\n (wm-score s)))", "expected": 535297483, "expected_by_seed": [ 535297483, 51001866, 281514363, 526295355 ], "batch_calls": 4, "warmup_calls": 5, "source": "bench/wm/wm-focus-cycle.scm", "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))", "guile_setup": "(define-module (vile benchmarks wm-focus-cycle) #:use-module (guile))\n(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (current-module))", "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.", "source_sha256": "c3bc6c5de68cb4a24904e34c8af01c5c60912f413471f644a958a913356c2793" }, { "name": "wm-tiling-layout", "category": "layout", "definitions": ";; A deterministic headless WM. Clients are [id workspace x y width height flags].\n;; State is [clients focus workspace ticks commands geometry managed config hooks seed].\n(define wm-modulus 1000000007)\n(define wm-config-generation 0)\n(define wm-active-keys '())\n(define wm-loaded-policy (lambda (s id) #f))\n\n(define (wm-new seed)\n (let ((clients (make-vector 64 #f)))\n (let loop ((id 0))\n (if (< id 64)\n (begin (vector-set! clients id (vector id (modulo id 4) 0 0 0 0 1))\n (loop (+ id 1)))))\n (vector clients (modulo seed 64) (modulo seed 4) 0 0 0 64 0 0 seed)))\n\n(define (wm-command s id code)\n (vector-set! s 4 (modulo (+ (* (vector-ref s 4) 17) (* id 3) code) wm-modulus))\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client (vector-set! client 6 (modulo (+ (vector-ref client 6) code) 256))))\n code)\n\n(define (wm-focus s start)\n (let ((clients (vector-ref s 0)) (workspace (vector-ref s 2)))\n (let loop ((left 64) (id (modulo start 64)))\n (if (= left 0) (vector-set! s 1 -1)\n (let ((client (vector-ref clients id)))\n (if (and client (= (vector-ref client 1) workspace)) (vector-set! s 1 id)\n (loop (- left 1) (modulo (+ id 1) 64))))))))\n\n(define (wm-switch s workspace)\n (vector-set! s 2 (modulo workspace 4))\n (wm-focus s (+ (vector-ref s 1) 1)))\n\n(define (wm-move s id workspace)\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client\n (begin (vector-set! client 1 (modulo workspace 4))\n (if (and (= id (vector-ref s 1)) (not (= (vector-ref client 1) (vector-ref s 2))))\n (wm-focus s (+ id 1))))))\n (wm-command s id 3))\n\n(define (wm-map s id workspace)\n (let ((clients (vector-ref s 0)))\n (if (not (vector-ref clients id)) (vector-set! s 6 (+ 1 (vector-ref s 6))))\n (vector-set! clients id (vector id (modulo workspace 4) 0 0 0 0 1))))\n\n(define (wm-unmap s id)\n (let ((clients (vector-ref s 0)))\n (if (vector-ref clients id)\n (begin (vector-set! clients id #f) (vector-set! s 6 (- (vector-ref s 6) 1)))))\n (if (= id (vector-ref s 1)) (wm-focus s (+ id 1))))\n\n(define (wm-layout s frame)\n (let* ((clients (vector-ref s 0)) (workspace (vector-ref s 2))\n (width (+ 1280 (* 8 (vector-ref s 9)))) (gap (+ 4 (modulo (vector-ref s 7) 5)))\n (master (quotient (* width 3) 5))\n (count (let scan ((id 0) (n 0))\n (if (= id 64) n\n (let ((c (vector-ref clients id)))\n (scan (+ id 1) (if (and c (= (vector-ref c 1) workspace)) (+ n 1) n)))))))\n (let place ((id 0) (rank 0))\n (if (< id 64)\n (let ((c (vector-ref clients id)))\n (if (and c (= (vector-ref c 1) workspace))\n (begin\n (if (or (= count 1) (= (modulo frame 2) 1))\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- width (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (if (= rank 0)\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- master (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (let ((height (quotient 720 (- count 1))))\n (vector-set! c 2 (+ master gap)) (vector-set! c 3 (+ gap (* (- rank 1) height)))\n (vector-set! c 4 (- width master (* 2 gap))) (vector-set! c 5 (- height (* 2 gap))))))\n (place (+ id 1) (+ rank 1)))\n (place (+ id 1) rank)))))\n (vector-set! s 5 (modulo (+ (vector-ref s 5) (* count 97) frame) wm-modulus))))\n\n(define wm-dispatch\n (vector (lambda(s id p)(wm-focus s id)) (lambda(s id p)(wm-switch s p))\n (lambda(s id p)(wm-move s id p)) (lambda(s id p)(wm-command s id p))\n (lambda(s id p)(wm-layout s p)) (lambda(s id p)(wm-map s id p))\n (lambda(s id p)(wm-unmap s id))\n (lambda(s id p)(vector-set! s 8 (+ (vector-ref s 8) p)))))\n\n(define (wm-event s kind id payload)\n (vector-set! s 3 (+ (vector-ref s 3) 1))\n ((vector-ref wm-dispatch kind) s id payload))\n\n(define (wm-leaf s id code) (wm-command s id code) (+ code 1))\n(define (wm-one s id code) (wm-leaf s id (+ code 1)))\n(define (wm-two s id code) (wm-one s id (+ code 1)))\n(define (wm-three s id code) (wm-two s id (+ code 1)))\n(define (wm-four s id code) (wm-three s id (+ code 1)))\n(define (wm-callback bias) (lambda(s id code)(wm-four s id (+ code bias))))\n(define (wm-invoke callback s id code) (callback s id code))\n\n(define-syntax wm-binding\n (syntax-rules () ((_ key modifiers action) (cons (cons key modifiers) action))))\n(define-syntax wm-keyset\n (syntax-rules () ((_ (key modifiers code) ...)\n (list (wm-binding key modifiers (wm-action code)) ...))))\n(define (wm-action code) (lambda(s id)(wm-command s id code)))\n(define (wm-keymap bias)\n (let loop ((id 31) (keys '()))\n (if (< id 0) keys\n (loop (- id 1) (cons (wm-binding (modulo id 8) (quotient id 8)\n (wm-action (+ (* (+ id 1) 3) bias))) keys)))))\n(define (wm-key s keys key modifiers id)\n (let ((binding (assoc (cons key modifiers) keys)))\n (if binding ((cdr binding) s id))))\n\n(define (wm-hook tag)\n (let ((count 0))\n (lambda(s id code)\n (set! count (+ count 1))\n (wm-command s id (+ tag code count))\n (vector-set! s 8 (+ (vector-ref s 8) count))\n (= (modulo code (+ tag 2)) 0))))\n(define (wm-deliver hooks s id code)\n (if (pair? hooks)\n (if (not ((car hooks) s id code)) (wm-deliver (cdr hooks) s id code))))\n\n(define (wm-macro-form bias)\n (cons 'wm-keyset\n (let loop ((id 31) (forms '()))\n (if (< id 0) forms\n (loop (- id 1) (cons (list (modulo id 8) (quotient id 8) (+ (* (+ id 1) 3) bias)) forms))))))\n(define (wm-load-config)\n (load (string-append wm-fixture-root \"/root.scm\")))\n(define (wm-apply-config s id)\n (vector-set! s 7 wm-config-generation)\n (wm-loaded-policy s id)\n (wm-key s wm-active-keys (modulo id 8) (modulo (quotient id 8) 4) id))\n\n(define (wm-score s)\n (let ((initial (let state ((i 1) (hash 19))\n (if (= i 10) hash (state (+ i 1) (modulo (+ (* hash 33) (vector-ref s i)) wm-modulus))))))\n (let clients ((id 0) (hash initial))\n (if (= id 64) hash\n (let ((c (vector-ref (vector-ref s 0) id)))\n (clients (+ id 1)\n (if c\n (let fields ((i 0) (h hash))\n (if (= i 7) h (fields (+ i 1) (modulo (+ (* h 33) (vector-ref c i)) wm-modulus))))\n (modulo (+ (* hash 33) 257) wm-modulus))))))))\n\n(define (benchmark seed)\n (let ((s (wm-new seed)) )\n \n (let loop ((i 0))\n (if (< i (+ 48 seed)) (begin (wm-switch s (+ i seed)) (wm-layout s i) (loop (+ i 1)))))\n (wm-score s)))", "expected": 239122862, "expected_by_seed": [ 239122862, 503413128, 970299409, 151603935 ], "batch_calls": 4, "warmup_calls": 5, "source": "bench/wm/wm-tiling-layout.scm", "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))", "guile_setup": "(define-module (vile benchmarks wm-tiling-layout) #:use-module (guile))\n(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (current-module))", "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.", "source_sha256": "a2eb44cdfd89e4b901110b31d92811651eabdf138479a2f6a967d11f52b3de67" }, { "name": "wm-workspace-move", "category": "state", "definitions": ";; A deterministic headless WM. Clients are [id workspace x y width height flags].\n;; State is [clients focus workspace ticks commands geometry managed config hooks seed].\n(define wm-modulus 1000000007)\n(define wm-config-generation 0)\n(define wm-active-keys '())\n(define wm-loaded-policy (lambda (s id) #f))\n\n(define (wm-new seed)\n (let ((clients (make-vector 64 #f)))\n (let loop ((id 0))\n (if (< id 64)\n (begin (vector-set! clients id (vector id (modulo id 4) 0 0 0 0 1))\n (loop (+ id 1)))))\n (vector clients (modulo seed 64) (modulo seed 4) 0 0 0 64 0 0 seed)))\n\n(define (wm-command s id code)\n (vector-set! s 4 (modulo (+ (* (vector-ref s 4) 17) (* id 3) code) wm-modulus))\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client (vector-set! client 6 (modulo (+ (vector-ref client 6) code) 256))))\n code)\n\n(define (wm-focus s start)\n (let ((clients (vector-ref s 0)) (workspace (vector-ref s 2)))\n (let loop ((left 64) (id (modulo start 64)))\n (if (= left 0) (vector-set! s 1 -1)\n (let ((client (vector-ref clients id)))\n (if (and client (= (vector-ref client 1) workspace)) (vector-set! s 1 id)\n (loop (- left 1) (modulo (+ id 1) 64))))))))\n\n(define (wm-switch s workspace)\n (vector-set! s 2 (modulo workspace 4))\n (wm-focus s (+ (vector-ref s 1) 1)))\n\n(define (wm-move s id workspace)\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client\n (begin (vector-set! client 1 (modulo workspace 4))\n (if (and (= id (vector-ref s 1)) (not (= (vector-ref client 1) (vector-ref s 2))))\n (wm-focus s (+ id 1))))))\n (wm-command s id 3))\n\n(define (wm-map s id workspace)\n (let ((clients (vector-ref s 0)))\n (if (not (vector-ref clients id)) (vector-set! s 6 (+ 1 (vector-ref s 6))))\n (vector-set! clients id (vector id (modulo workspace 4) 0 0 0 0 1))))\n\n(define (wm-unmap s id)\n (let ((clients (vector-ref s 0)))\n (if (vector-ref clients id)\n (begin (vector-set! clients id #f) (vector-set! s 6 (- (vector-ref s 6) 1)))))\n (if (= id (vector-ref s 1)) (wm-focus s (+ id 1))))\n\n(define (wm-layout s frame)\n (let* ((clients (vector-ref s 0)) (workspace (vector-ref s 2))\n (width (+ 1280 (* 8 (vector-ref s 9)))) (gap (+ 4 (modulo (vector-ref s 7) 5)))\n (master (quotient (* width 3) 5))\n (count (let scan ((id 0) (n 0))\n (if (= id 64) n\n (let ((c (vector-ref clients id)))\n (scan (+ id 1) (if (and c (= (vector-ref c 1) workspace)) (+ n 1) n)))))))\n (let place ((id 0) (rank 0))\n (if (< id 64)\n (let ((c (vector-ref clients id)))\n (if (and c (= (vector-ref c 1) workspace))\n (begin\n (if (or (= count 1) (= (modulo frame 2) 1))\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- width (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (if (= rank 0)\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- master (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (let ((height (quotient 720 (- count 1))))\n (vector-set! c 2 (+ master gap)) (vector-set! c 3 (+ gap (* (- rank 1) height)))\n (vector-set! c 4 (- width master (* 2 gap))) (vector-set! c 5 (- height (* 2 gap))))))\n (place (+ id 1) (+ rank 1)))\n (place (+ id 1) rank)))))\n (vector-set! s 5 (modulo (+ (vector-ref s 5) (* count 97) frame) wm-modulus))))\n\n(define wm-dispatch\n (vector (lambda(s id p)(wm-focus s id)) (lambda(s id p)(wm-switch s p))\n (lambda(s id p)(wm-move s id p)) (lambda(s id p)(wm-command s id p))\n (lambda(s id p)(wm-layout s p)) (lambda(s id p)(wm-map s id p))\n (lambda(s id p)(wm-unmap s id))\n (lambda(s id p)(vector-set! s 8 (+ (vector-ref s 8) p)))))\n\n(define (wm-event s kind id payload)\n (vector-set! s 3 (+ (vector-ref s 3) 1))\n ((vector-ref wm-dispatch kind) s id payload))\n\n(define (wm-leaf s id code) (wm-command s id code) (+ code 1))\n(define (wm-one s id code) (wm-leaf s id (+ code 1)))\n(define (wm-two s id code) (wm-one s id (+ code 1)))\n(define (wm-three s id code) (wm-two s id (+ code 1)))\n(define (wm-four s id code) (wm-three s id (+ code 1)))\n(define (wm-callback bias) (lambda(s id code)(wm-four s id (+ code bias))))\n(define (wm-invoke callback s id code) (callback s id code))\n\n(define-syntax wm-binding\n (syntax-rules () ((_ key modifiers action) (cons (cons key modifiers) action))))\n(define-syntax wm-keyset\n (syntax-rules () ((_ (key modifiers code) ...)\n (list (wm-binding key modifiers (wm-action code)) ...))))\n(define (wm-action code) (lambda(s id)(wm-command s id code)))\n(define (wm-keymap bias)\n (let loop ((id 31) (keys '()))\n (if (< id 0) keys\n (loop (- id 1) (cons (wm-binding (modulo id 8) (quotient id 8)\n (wm-action (+ (* (+ id 1) 3) bias))) keys)))))\n(define (wm-key s keys key modifiers id)\n (let ((binding (assoc (cons key modifiers) keys)))\n (if binding ((cdr binding) s id))))\n\n(define (wm-hook tag)\n (let ((count 0))\n (lambda(s id code)\n (set! count (+ count 1))\n (wm-command s id (+ tag code count))\n (vector-set! s 8 (+ (vector-ref s 8) count))\n (= (modulo code (+ tag 2)) 0))))\n(define (wm-deliver hooks s id code)\n (if (pair? hooks)\n (if (not ((car hooks) s id code)) (wm-deliver (cdr hooks) s id code))))\n\n(define (wm-macro-form bias)\n (cons 'wm-keyset\n (let loop ((id 31) (forms '()))\n (if (< id 0) forms\n (loop (- id 1) (cons (list (modulo id 8) (quotient id 8) (+ (* (+ id 1) 3) bias)) forms))))))\n(define (wm-load-config)\n (load (string-append wm-fixture-root \"/root.scm\")))\n(define (wm-apply-config s id)\n (vector-set! s 7 wm-config-generation)\n (wm-loaded-policy s id)\n (wm-key s wm-active-keys (modulo id 8) (modulo (quotient id 8) 4) id))\n\n(define (wm-score s)\n (let ((initial (let state ((i 1) (hash 19))\n (if (= i 10) hash (state (+ i 1) (modulo (+ (* hash 33) (vector-ref s i)) wm-modulus))))))\n (let clients ((id 0) (hash initial))\n (if (= id 64) hash\n (let ((c (vector-ref (vector-ref s 0) id)))\n (clients (+ id 1)\n (if c\n (let fields ((i 0) (h hash))\n (if (= i 7) h (fields (+ i 1) (modulo (+ (* h 33) (vector-ref c i)) wm-modulus))))\n (modulo (+ (* hash 33) 257) wm-modulus))))))))\n\n(define (benchmark seed)\n (let ((s (wm-new seed)) )\n \n (let loop ((i 0))\n (if (< i (+ 1024 (* 8 seed))) (begin (wm-move s (modulo (+ (* i 11) seed) 64) (+ i seed))\n (if (= (modulo i 31) 0) (wm-switch s (quotient i 31))) (loop (+ i 1)))))\n (wm-score s)))", "expected": 944497161, "expected_by_seed": [ 944497161, 402600027, 341068392, 211255284 ], "batch_calls": 4, "warmup_calls": 5, "source": "bench/wm/wm-workspace-move.scm", "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))", "guile_setup": "(define-module (vile benchmarks wm-workspace-move) #:use-module (guile))\n(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (current-module))", "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.", "source_sha256": "b6fca65145ec75237cf547a309ef8d21299eadbaf22d2ce89cc9308b135c5cf1" }, { "name": "wm-keybindings", "category": "calls", "definitions": ";; A deterministic headless WM. Clients are [id workspace x y width height flags].\n;; State is [clients focus workspace ticks commands geometry managed config hooks seed].\n(define wm-modulus 1000000007)\n(define wm-config-generation 0)\n(define wm-active-keys '())\n(define wm-loaded-policy (lambda (s id) #f))\n\n(define (wm-new seed)\n (let ((clients (make-vector 64 #f)))\n (let loop ((id 0))\n (if (< id 64)\n (begin (vector-set! clients id (vector id (modulo id 4) 0 0 0 0 1))\n (loop (+ id 1)))))\n (vector clients (modulo seed 64) (modulo seed 4) 0 0 0 64 0 0 seed)))\n\n(define (wm-command s id code)\n (vector-set! s 4 (modulo (+ (* (vector-ref s 4) 17) (* id 3) code) wm-modulus))\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client (vector-set! client 6 (modulo (+ (vector-ref client 6) code) 256))))\n code)\n\n(define (wm-focus s start)\n (let ((clients (vector-ref s 0)) (workspace (vector-ref s 2)))\n (let loop ((left 64) (id (modulo start 64)))\n (if (= left 0) (vector-set! s 1 -1)\n (let ((client (vector-ref clients id)))\n (if (and client (= (vector-ref client 1) workspace)) (vector-set! s 1 id)\n (loop (- left 1) (modulo (+ id 1) 64))))))))\n\n(define (wm-switch s workspace)\n (vector-set! s 2 (modulo workspace 4))\n (wm-focus s (+ (vector-ref s 1) 1)))\n\n(define (wm-move s id workspace)\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client\n (begin (vector-set! client 1 (modulo workspace 4))\n (if (and (= id (vector-ref s 1)) (not (= (vector-ref client 1) (vector-ref s 2))))\n (wm-focus s (+ id 1))))))\n (wm-command s id 3))\n\n(define (wm-map s id workspace)\n (let ((clients (vector-ref s 0)))\n (if (not (vector-ref clients id)) (vector-set! s 6 (+ 1 (vector-ref s 6))))\n (vector-set! clients id (vector id (modulo workspace 4) 0 0 0 0 1))))\n\n(define (wm-unmap s id)\n (let ((clients (vector-ref s 0)))\n (if (vector-ref clients id)\n (begin (vector-set! clients id #f) (vector-set! s 6 (- (vector-ref s 6) 1)))))\n (if (= id (vector-ref s 1)) (wm-focus s (+ id 1))))\n\n(define (wm-layout s frame)\n (let* ((clients (vector-ref s 0)) (workspace (vector-ref s 2))\n (width (+ 1280 (* 8 (vector-ref s 9)))) (gap (+ 4 (modulo (vector-ref s 7) 5)))\n (master (quotient (* width 3) 5))\n (count (let scan ((id 0) (n 0))\n (if (= id 64) n\n (let ((c (vector-ref clients id)))\n (scan (+ id 1) (if (and c (= (vector-ref c 1) workspace)) (+ n 1) n)))))))\n (let place ((id 0) (rank 0))\n (if (< id 64)\n (let ((c (vector-ref clients id)))\n (if (and c (= (vector-ref c 1) workspace))\n (begin\n (if (or (= count 1) (= (modulo frame 2) 1))\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- width (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (if (= rank 0)\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- master (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (let ((height (quotient 720 (- count 1))))\n (vector-set! c 2 (+ master gap)) (vector-set! c 3 (+ gap (* (- rank 1) height)))\n (vector-set! c 4 (- width master (* 2 gap))) (vector-set! c 5 (- height (* 2 gap))))))\n (place (+ id 1) (+ rank 1)))\n (place (+ id 1) rank)))))\n (vector-set! s 5 (modulo (+ (vector-ref s 5) (* count 97) frame) wm-modulus))))\n\n(define wm-dispatch\n (vector (lambda(s id p)(wm-focus s id)) (lambda(s id p)(wm-switch s p))\n (lambda(s id p)(wm-move s id p)) (lambda(s id p)(wm-command s id p))\n (lambda(s id p)(wm-layout s p)) (lambda(s id p)(wm-map s id p))\n (lambda(s id p)(wm-unmap s id))\n (lambda(s id p)(vector-set! s 8 (+ (vector-ref s 8) p)))))\n\n(define (wm-event s kind id payload)\n (vector-set! s 3 (+ (vector-ref s 3) 1))\n ((vector-ref wm-dispatch kind) s id payload))\n\n(define (wm-leaf s id code) (wm-command s id code) (+ code 1))\n(define (wm-one s id code) (wm-leaf s id (+ code 1)))\n(define (wm-two s id code) (wm-one s id (+ code 1)))\n(define (wm-three s id code) (wm-two s id (+ code 1)))\n(define (wm-four s id code) (wm-three s id (+ code 1)))\n(define (wm-callback bias) (lambda(s id code)(wm-four s id (+ code bias))))\n(define (wm-invoke callback s id code) (callback s id code))\n\n(define-syntax wm-binding\n (syntax-rules () ((_ key modifiers action) (cons (cons key modifiers) action))))\n(define-syntax wm-keyset\n (syntax-rules () ((_ (key modifiers code) ...)\n (list (wm-binding key modifiers (wm-action code)) ...))))\n(define (wm-action code) (lambda(s id)(wm-command s id code)))\n(define (wm-keymap bias)\n (let loop ((id 31) (keys '()))\n (if (< id 0) keys\n (loop (- id 1) (cons (wm-binding (modulo id 8) (quotient id 8)\n (wm-action (+ (* (+ id 1) 3) bias))) keys)))))\n(define (wm-key s keys key modifiers id)\n (let ((binding (assoc (cons key modifiers) keys)))\n (if binding ((cdr binding) s id))))\n\n(define (wm-hook tag)\n (let ((count 0))\n (lambda(s id code)\n (set! count (+ count 1))\n (wm-command s id (+ tag code count))\n (vector-set! s 8 (+ (vector-ref s 8) count))\n (= (modulo code (+ tag 2)) 0))))\n(define (wm-deliver hooks s id code)\n (if (pair? hooks)\n (if (not ((car hooks) s id code)) (wm-deliver (cdr hooks) s id code))))\n\n(define (wm-macro-form bias)\n (cons 'wm-keyset\n (let loop ((id 31) (forms '()))\n (if (< id 0) forms\n (loop (- id 1) (cons (list (modulo id 8) (quotient id 8) (+ (* (+ id 1) 3) bias)) forms))))))\n(define (wm-load-config)\n (load (string-append wm-fixture-root \"/root.scm\")))\n(define (wm-apply-config s id)\n (vector-set! s 7 wm-config-generation)\n (wm-loaded-policy s id)\n (wm-key s wm-active-keys (modulo id 8) (modulo (quotient id 8) 4) id))\n\n(define (wm-score s)\n (let ((initial (let state ((i 1) (hash 19))\n (if (= i 10) hash (state (+ i 1) (modulo (+ (* hash 33) (vector-ref s i)) wm-modulus))))))\n (let clients ((id 0) (hash initial))\n (if (= id 64) hash\n (let ((c (vector-ref (vector-ref s 0) id)))\n (clients (+ id 1)\n (if c\n (let fields ((i 0) (h hash))\n (if (= i 7) h (fields (+ i 1) (modulo (+ (* h 33) (vector-ref c i)) wm-modulus))))\n (modulo (+ (* hash 33) 257) wm-modulus))))))))\n\n(define (benchmark seed)\n (let ((s (wm-new seed)) (keys (wm-keymap seed)))\n \n (let loop ((i 0))\n (if (< i (+ 512 (* 8 seed))) (begin (wm-key s keys (modulo (+ (* i 7) seed) 8) (modulo (+ (quotient i 8) seed) 4) (modulo (+ (* i 13) seed) 64)) (loop (+ i 1)))))\n (wm-score s)))", "expected": 494793665, "expected_by_seed": [ 494793665, 420630214, 517122330, 377293159 ], "batch_calls": 4, "warmup_calls": 5, "source": "bench/wm/wm-keybindings.scm", "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))", "guile_setup": "(define-module (vile benchmarks wm-keybindings) #:use-module (guile))\n(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (current-module))", "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.", "source_sha256": "4971e869e3a789eb05e14d44b2d458dcfeb12d03ec9bf854bc07983f1a52b367" }, { "name": "wm-hooks", "category": "calls", "definitions": ";; A deterministic headless WM. Clients are [id workspace x y width height flags].\n;; State is [clients focus workspace ticks commands geometry managed config hooks seed].\n(define wm-modulus 1000000007)\n(define wm-config-generation 0)\n(define wm-active-keys '())\n(define wm-loaded-policy (lambda (s id) #f))\n\n(define (wm-new seed)\n (let ((clients (make-vector 64 #f)))\n (let loop ((id 0))\n (if (< id 64)\n (begin (vector-set! clients id (vector id (modulo id 4) 0 0 0 0 1))\n (loop (+ id 1)))))\n (vector clients (modulo seed 64) (modulo seed 4) 0 0 0 64 0 0 seed)))\n\n(define (wm-command s id code)\n (vector-set! s 4 (modulo (+ (* (vector-ref s 4) 17) (* id 3) code) wm-modulus))\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client (vector-set! client 6 (modulo (+ (vector-ref client 6) code) 256))))\n code)\n\n(define (wm-focus s start)\n (let ((clients (vector-ref s 0)) (workspace (vector-ref s 2)))\n (let loop ((left 64) (id (modulo start 64)))\n (if (= left 0) (vector-set! s 1 -1)\n (let ((client (vector-ref clients id)))\n (if (and client (= (vector-ref client 1) workspace)) (vector-set! s 1 id)\n (loop (- left 1) (modulo (+ id 1) 64))))))))\n\n(define (wm-switch s workspace)\n (vector-set! s 2 (modulo workspace 4))\n (wm-focus s (+ (vector-ref s 1) 1)))\n\n(define (wm-move s id workspace)\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client\n (begin (vector-set! client 1 (modulo workspace 4))\n (if (and (= id (vector-ref s 1)) (not (= (vector-ref client 1) (vector-ref s 2))))\n (wm-focus s (+ id 1))))))\n (wm-command s id 3))\n\n(define (wm-map s id workspace)\n (let ((clients (vector-ref s 0)))\n (if (not (vector-ref clients id)) (vector-set! s 6 (+ 1 (vector-ref s 6))))\n (vector-set! clients id (vector id (modulo workspace 4) 0 0 0 0 1))))\n\n(define (wm-unmap s id)\n (let ((clients (vector-ref s 0)))\n (if (vector-ref clients id)\n (begin (vector-set! clients id #f) (vector-set! s 6 (- (vector-ref s 6) 1)))))\n (if (= id (vector-ref s 1)) (wm-focus s (+ id 1))))\n\n(define (wm-layout s frame)\n (let* ((clients (vector-ref s 0)) (workspace (vector-ref s 2))\n (width (+ 1280 (* 8 (vector-ref s 9)))) (gap (+ 4 (modulo (vector-ref s 7) 5)))\n (master (quotient (* width 3) 5))\n (count (let scan ((id 0) (n 0))\n (if (= id 64) n\n (let ((c (vector-ref clients id)))\n (scan (+ id 1) (if (and c (= (vector-ref c 1) workspace)) (+ n 1) n)))))))\n (let place ((id 0) (rank 0))\n (if (< id 64)\n (let ((c (vector-ref clients id)))\n (if (and c (= (vector-ref c 1) workspace))\n (begin\n (if (or (= count 1) (= (modulo frame 2) 1))\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- width (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (if (= rank 0)\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- master (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (let ((height (quotient 720 (- count 1))))\n (vector-set! c 2 (+ master gap)) (vector-set! c 3 (+ gap (* (- rank 1) height)))\n (vector-set! c 4 (- width master (* 2 gap))) (vector-set! c 5 (- height (* 2 gap))))))\n (place (+ id 1) (+ rank 1)))\n (place (+ id 1) rank)))))\n (vector-set! s 5 (modulo (+ (vector-ref s 5) (* count 97) frame) wm-modulus))))\n\n(define wm-dispatch\n (vector (lambda(s id p)(wm-focus s id)) (lambda(s id p)(wm-switch s p))\n (lambda(s id p)(wm-move s id p)) (lambda(s id p)(wm-command s id p))\n (lambda(s id p)(wm-layout s p)) (lambda(s id p)(wm-map s id p))\n (lambda(s id p)(wm-unmap s id))\n (lambda(s id p)(vector-set! s 8 (+ (vector-ref s 8) p)))))\n\n(define (wm-event s kind id payload)\n (vector-set! s 3 (+ (vector-ref s 3) 1))\n ((vector-ref wm-dispatch kind) s id payload))\n\n(define (wm-leaf s id code) (wm-command s id code) (+ code 1))\n(define (wm-one s id code) (wm-leaf s id (+ code 1)))\n(define (wm-two s id code) (wm-one s id (+ code 1)))\n(define (wm-three s id code) (wm-two s id (+ code 1)))\n(define (wm-four s id code) (wm-three s id (+ code 1)))\n(define (wm-callback bias) (lambda(s id code)(wm-four s id (+ code bias))))\n(define (wm-invoke callback s id code) (callback s id code))\n\n(define-syntax wm-binding\n (syntax-rules () ((_ key modifiers action) (cons (cons key modifiers) action))))\n(define-syntax wm-keyset\n (syntax-rules () ((_ (key modifiers code) ...)\n (list (wm-binding key modifiers (wm-action code)) ...))))\n(define (wm-action code) (lambda(s id)(wm-command s id code)))\n(define (wm-keymap bias)\n (let loop ((id 31) (keys '()))\n (if (< id 0) keys\n (loop (- id 1) (cons (wm-binding (modulo id 8) (quotient id 8)\n (wm-action (+ (* (+ id 1) 3) bias))) keys)))))\n(define (wm-key s keys key modifiers id)\n (let ((binding (assoc (cons key modifiers) keys)))\n (if binding ((cdr binding) s id))))\n\n(define (wm-hook tag)\n (let ((count 0))\n (lambda(s id code)\n (set! count (+ count 1))\n (wm-command s id (+ tag code count))\n (vector-set! s 8 (+ (vector-ref s 8) count))\n (= (modulo code (+ tag 2)) 0))))\n(define (wm-deliver hooks s id code)\n (if (pair? hooks)\n (if (not ((car hooks) s id code)) (wm-deliver (cdr hooks) s id code))))\n\n(define (wm-macro-form bias)\n (cons 'wm-keyset\n (let loop ((id 31) (forms '()))\n (if (< id 0) forms\n (loop (- id 1) (cons (list (modulo id 8) (quotient id 8) (+ (* (+ id 1) 3) bias)) forms))))))\n(define (wm-load-config)\n (load (string-append wm-fixture-root \"/root.scm\")))\n(define (wm-apply-config s id)\n (vector-set! s 7 wm-config-generation)\n (wm-loaded-policy s id)\n (wm-key s wm-active-keys (modulo id 8) (modulo (quotient id 8) 4) id))\n\n(define (wm-score s)\n (let ((initial (let state ((i 1) (hash 19))\n (if (= i 10) hash (state (+ i 1) (modulo (+ (* hash 33) (vector-ref s i)) wm-modulus))))))\n (let clients ((id 0) (hash initial))\n (if (= id 64) hash\n (let ((c (vector-ref (vector-ref s 0) id)))\n (clients (+ id 1)\n (if c\n (let fields ((i 0) (h hash))\n (if (= i 7) h (fields (+ i 1) (modulo (+ (* h 33) (vector-ref c i)) wm-modulus))))\n (modulo (+ (* hash 33) 257) wm-modulus))))))))\n\n(define (benchmark seed)\n (let ((s (wm-new seed)) (hooks (list (wm-hook 1) (wm-hook 2) (wm-hook 3) (wm-hook 4))))\n \n (let loop ((i 0))\n (if (< i (+ 1024 (* 8 seed))) (begin (wm-deliver hooks s (modulo (+ (* i 7) seed) 64) (modulo i 13)) (loop (+ i 1)))))\n (wm-score s)))", "expected": 261284825, "expected_by_seed": [ 261284825, 226339409, 836561432, 183419363 ], "batch_calls": 4, "warmup_calls": 5, "source": "bench/wm/wm-hooks.scm", "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))", "guile_setup": "(define-module (vile benchmarks wm-hooks) #:use-module (guile))\n(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (current-module))", "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.", "source_sha256": "06de2d71f02670ccb1a6bf9b95df6ce82a1d4cba53b03f1581a65be34efe56e8" }, { "name": "wm-lifecycle", "category": "allocation", "definitions": ";; A deterministic headless WM. Clients are [id workspace x y width height flags].\n;; State is [clients focus workspace ticks commands geometry managed config hooks seed].\n(define wm-modulus 1000000007)\n(define wm-config-generation 0)\n(define wm-active-keys '())\n(define wm-loaded-policy (lambda (s id) #f))\n\n(define (wm-new seed)\n (let ((clients (make-vector 64 #f)))\n (let loop ((id 0))\n (if (< id 64)\n (begin (vector-set! clients id (vector id (modulo id 4) 0 0 0 0 1))\n (loop (+ id 1)))))\n (vector clients (modulo seed 64) (modulo seed 4) 0 0 0 64 0 0 seed)))\n\n(define (wm-command s id code)\n (vector-set! s 4 (modulo (+ (* (vector-ref s 4) 17) (* id 3) code) wm-modulus))\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client (vector-set! client 6 (modulo (+ (vector-ref client 6) code) 256))))\n code)\n\n(define (wm-focus s start)\n (let ((clients (vector-ref s 0)) (workspace (vector-ref s 2)))\n (let loop ((left 64) (id (modulo start 64)))\n (if (= left 0) (vector-set! s 1 -1)\n (let ((client (vector-ref clients id)))\n (if (and client (= (vector-ref client 1) workspace)) (vector-set! s 1 id)\n (loop (- left 1) (modulo (+ id 1) 64))))))))\n\n(define (wm-switch s workspace)\n (vector-set! s 2 (modulo workspace 4))\n (wm-focus s (+ (vector-ref s 1) 1)))\n\n(define (wm-move s id workspace)\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client\n (begin (vector-set! client 1 (modulo workspace 4))\n (if (and (= id (vector-ref s 1)) (not (= (vector-ref client 1) (vector-ref s 2))))\n (wm-focus s (+ id 1))))))\n (wm-command s id 3))\n\n(define (wm-map s id workspace)\n (let ((clients (vector-ref s 0)))\n (if (not (vector-ref clients id)) (vector-set! s 6 (+ 1 (vector-ref s 6))))\n (vector-set! clients id (vector id (modulo workspace 4) 0 0 0 0 1))))\n\n(define (wm-unmap s id)\n (let ((clients (vector-ref s 0)))\n (if (vector-ref clients id)\n (begin (vector-set! clients id #f) (vector-set! s 6 (- (vector-ref s 6) 1)))))\n (if (= id (vector-ref s 1)) (wm-focus s (+ id 1))))\n\n(define (wm-layout s frame)\n (let* ((clients (vector-ref s 0)) (workspace (vector-ref s 2))\n (width (+ 1280 (* 8 (vector-ref s 9)))) (gap (+ 4 (modulo (vector-ref s 7) 5)))\n (master (quotient (* width 3) 5))\n (count (let scan ((id 0) (n 0))\n (if (= id 64) n\n (let ((c (vector-ref clients id)))\n (scan (+ id 1) (if (and c (= (vector-ref c 1) workspace)) (+ n 1) n)))))))\n (let place ((id 0) (rank 0))\n (if (< id 64)\n (let ((c (vector-ref clients id)))\n (if (and c (= (vector-ref c 1) workspace))\n (begin\n (if (or (= count 1) (= (modulo frame 2) 1))\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- width (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (if (= rank 0)\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- master (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (let ((height (quotient 720 (- count 1))))\n (vector-set! c 2 (+ master gap)) (vector-set! c 3 (+ gap (* (- rank 1) height)))\n (vector-set! c 4 (- width master (* 2 gap))) (vector-set! c 5 (- height (* 2 gap))))))\n (place (+ id 1) (+ rank 1)))\n (place (+ id 1) rank)))))\n (vector-set! s 5 (modulo (+ (vector-ref s 5) (* count 97) frame) wm-modulus))))\n\n(define wm-dispatch\n (vector (lambda(s id p)(wm-focus s id)) (lambda(s id p)(wm-switch s p))\n (lambda(s id p)(wm-move s id p)) (lambda(s id p)(wm-command s id p))\n (lambda(s id p)(wm-layout s p)) (lambda(s id p)(wm-map s id p))\n (lambda(s id p)(wm-unmap s id))\n (lambda(s id p)(vector-set! s 8 (+ (vector-ref s 8) p)))))\n\n(define (wm-event s kind id payload)\n (vector-set! s 3 (+ (vector-ref s 3) 1))\n ((vector-ref wm-dispatch kind) s id payload))\n\n(define (wm-leaf s id code) (wm-command s id code) (+ code 1))\n(define (wm-one s id code) (wm-leaf s id (+ code 1)))\n(define (wm-two s id code) (wm-one s id (+ code 1)))\n(define (wm-three s id code) (wm-two s id (+ code 1)))\n(define (wm-four s id code) (wm-three s id (+ code 1)))\n(define (wm-callback bias) (lambda(s id code)(wm-four s id (+ code bias))))\n(define (wm-invoke callback s id code) (callback s id code))\n\n(define-syntax wm-binding\n (syntax-rules () ((_ key modifiers action) (cons (cons key modifiers) action))))\n(define-syntax wm-keyset\n (syntax-rules () ((_ (key modifiers code) ...)\n (list (wm-binding key modifiers (wm-action code)) ...))))\n(define (wm-action code) (lambda(s id)(wm-command s id code)))\n(define (wm-keymap bias)\n (let loop ((id 31) (keys '()))\n (if (< id 0) keys\n (loop (- id 1) (cons (wm-binding (modulo id 8) (quotient id 8)\n (wm-action (+ (* (+ id 1) 3) bias))) keys)))))\n(define (wm-key s keys key modifiers id)\n (let ((binding (assoc (cons key modifiers) keys)))\n (if binding ((cdr binding) s id))))\n\n(define (wm-hook tag)\n (let ((count 0))\n (lambda(s id code)\n (set! count (+ count 1))\n (wm-command s id (+ tag code count))\n (vector-set! s 8 (+ (vector-ref s 8) count))\n (= (modulo code (+ tag 2)) 0))))\n(define (wm-deliver hooks s id code)\n (if (pair? hooks)\n (if (not ((car hooks) s id code)) (wm-deliver (cdr hooks) s id code))))\n\n(define (wm-macro-form bias)\n (cons 'wm-keyset\n (let loop ((id 31) (forms '()))\n (if (< id 0) forms\n (loop (- id 1) (cons (list (modulo id 8) (quotient id 8) (+ (* (+ id 1) 3) bias)) forms))))))\n(define (wm-load-config)\n (load (string-append wm-fixture-root \"/root.scm\")))\n(define (wm-apply-config s id)\n (vector-set! s 7 wm-config-generation)\n (wm-loaded-policy s id)\n (wm-key s wm-active-keys (modulo id 8) (modulo (quotient id 8) 4) id))\n\n(define (wm-score s)\n (let ((initial (let state ((i 1) (hash 19))\n (if (= i 10) hash (state (+ i 1) (modulo (+ (* hash 33) (vector-ref s i)) wm-modulus))))))\n (let clients ((id 0) (hash initial))\n (if (= id 64) hash\n (let ((c (vector-ref (vector-ref s 0) id)))\n (clients (+ id 1)\n (if c\n (let fields ((i 0) (h hash))\n (if (= i 7) h (fields (+ i 1) (modulo (+ (* h 33) (vector-ref c i)) wm-modulus))))\n (modulo (+ (* hash 33) 257) wm-modulus))))))))\n\n(define (benchmark seed)\n (let ((s (wm-new seed)) )\n \n (let loop ((i 0))\n (if (< i (+ 1024 (* 8 seed))) (begin (let ((id (modulo (+ (* i 13) seed) 64)))\n (if (= (modulo i 3) 0) (wm-unmap s id) (wm-map s id (+ i seed)))\n (if (= (modulo i 16) 0) (wm-focus s id))) (loop (+ i 1)))))\n (wm-score s)))", "expected": 848383737, "expected_by_seed": [ 848383737, 720750568, 310968481, 357222457 ], "batch_calls": 4, "warmup_calls": 5, "source": "bench/wm/wm-lifecycle.scm", "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))", "guile_setup": "(define-module (vile benchmarks wm-lifecycle) #:use-module (guile))\n(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (current-module))", "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.", "source_sha256": "2454d01f95191179f045aebffe8a67852b46a606ace10899fb662e62359f87d2" }, { "name": "wm-macro-config", "category": "expansion", "definitions": ";; A deterministic headless WM. Clients are [id workspace x y width height flags].\n;; State is [clients focus workspace ticks commands geometry managed config hooks seed].\n(define wm-modulus 1000000007)\n(define wm-config-generation 0)\n(define wm-active-keys '())\n(define wm-loaded-policy (lambda (s id) #f))\n\n(define (wm-new seed)\n (let ((clients (make-vector 64 #f)))\n (let loop ((id 0))\n (if (< id 64)\n (begin (vector-set! clients id (vector id (modulo id 4) 0 0 0 0 1))\n (loop (+ id 1)))))\n (vector clients (modulo seed 64) (modulo seed 4) 0 0 0 64 0 0 seed)))\n\n(define (wm-command s id code)\n (vector-set! s 4 (modulo (+ (* (vector-ref s 4) 17) (* id 3) code) wm-modulus))\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client (vector-set! client 6 (modulo (+ (vector-ref client 6) code) 256))))\n code)\n\n(define (wm-focus s start)\n (let ((clients (vector-ref s 0)) (workspace (vector-ref s 2)))\n (let loop ((left 64) (id (modulo start 64)))\n (if (= left 0) (vector-set! s 1 -1)\n (let ((client (vector-ref clients id)))\n (if (and client (= (vector-ref client 1) workspace)) (vector-set! s 1 id)\n (loop (- left 1) (modulo (+ id 1) 64))))))))\n\n(define (wm-switch s workspace)\n (vector-set! s 2 (modulo workspace 4))\n (wm-focus s (+ (vector-ref s 1) 1)))\n\n(define (wm-move s id workspace)\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client\n (begin (vector-set! client 1 (modulo workspace 4))\n (if (and (= id (vector-ref s 1)) (not (= (vector-ref client 1) (vector-ref s 2))))\n (wm-focus s (+ id 1))))))\n (wm-command s id 3))\n\n(define (wm-map s id workspace)\n (let ((clients (vector-ref s 0)))\n (if (not (vector-ref clients id)) (vector-set! s 6 (+ 1 (vector-ref s 6))))\n (vector-set! clients id (vector id (modulo workspace 4) 0 0 0 0 1))))\n\n(define (wm-unmap s id)\n (let ((clients (vector-ref s 0)))\n (if (vector-ref clients id)\n (begin (vector-set! clients id #f) (vector-set! s 6 (- (vector-ref s 6) 1)))))\n (if (= id (vector-ref s 1)) (wm-focus s (+ id 1))))\n\n(define (wm-layout s frame)\n (let* ((clients (vector-ref s 0)) (workspace (vector-ref s 2))\n (width (+ 1280 (* 8 (vector-ref s 9)))) (gap (+ 4 (modulo (vector-ref s 7) 5)))\n (master (quotient (* width 3) 5))\n (count (let scan ((id 0) (n 0))\n (if (= id 64) n\n (let ((c (vector-ref clients id)))\n (scan (+ id 1) (if (and c (= (vector-ref c 1) workspace)) (+ n 1) n)))))))\n (let place ((id 0) (rank 0))\n (if (< id 64)\n (let ((c (vector-ref clients id)))\n (if (and c (= (vector-ref c 1) workspace))\n (begin\n (if (or (= count 1) (= (modulo frame 2) 1))\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- width (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (if (= rank 0)\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- master (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (let ((height (quotient 720 (- count 1))))\n (vector-set! c 2 (+ master gap)) (vector-set! c 3 (+ gap (* (- rank 1) height)))\n (vector-set! c 4 (- width master (* 2 gap))) (vector-set! c 5 (- height (* 2 gap))))))\n (place (+ id 1) (+ rank 1)))\n (place (+ id 1) rank)))))\n (vector-set! s 5 (modulo (+ (vector-ref s 5) (* count 97) frame) wm-modulus))))\n\n(define wm-dispatch\n (vector (lambda(s id p)(wm-focus s id)) (lambda(s id p)(wm-switch s p))\n (lambda(s id p)(wm-move s id p)) (lambda(s id p)(wm-command s id p))\n (lambda(s id p)(wm-layout s p)) (lambda(s id p)(wm-map s id p))\n (lambda(s id p)(wm-unmap s id))\n (lambda(s id p)(vector-set! s 8 (+ (vector-ref s 8) p)))))\n\n(define (wm-event s kind id payload)\n (vector-set! s 3 (+ (vector-ref s 3) 1))\n ((vector-ref wm-dispatch kind) s id payload))\n\n(define (wm-leaf s id code) (wm-command s id code) (+ code 1))\n(define (wm-one s id code) (wm-leaf s id (+ code 1)))\n(define (wm-two s id code) (wm-one s id (+ code 1)))\n(define (wm-three s id code) (wm-two s id (+ code 1)))\n(define (wm-four s id code) (wm-three s id (+ code 1)))\n(define (wm-callback bias) (lambda(s id code)(wm-four s id (+ code bias))))\n(define (wm-invoke callback s id code) (callback s id code))\n\n(define-syntax wm-binding\n (syntax-rules () ((_ key modifiers action) (cons (cons key modifiers) action))))\n(define-syntax wm-keyset\n (syntax-rules () ((_ (key modifiers code) ...)\n (list (wm-binding key modifiers (wm-action code)) ...))))\n(define (wm-action code) (lambda(s id)(wm-command s id code)))\n(define (wm-keymap bias)\n (let loop ((id 31) (keys '()))\n (if (< id 0) keys\n (loop (- id 1) (cons (wm-binding (modulo id 8) (quotient id 8)\n (wm-action (+ (* (+ id 1) 3) bias))) keys)))))\n(define (wm-key s keys key modifiers id)\n (let ((binding (assoc (cons key modifiers) keys)))\n (if binding ((cdr binding) s id))))\n\n(define (wm-hook tag)\n (let ((count 0))\n (lambda(s id code)\n (set! count (+ count 1))\n (wm-command s id (+ tag code count))\n (vector-set! s 8 (+ (vector-ref s 8) count))\n (= (modulo code (+ tag 2)) 0))))\n(define (wm-deliver hooks s id code)\n (if (pair? hooks)\n (if (not ((car hooks) s id code)) (wm-deliver (cdr hooks) s id code))))\n\n(define (wm-macro-form bias)\n (cons 'wm-keyset\n (let loop ((id 31) (forms '()))\n (if (< id 0) forms\n (loop (- id 1) (cons (list (modulo id 8) (quotient id 8) (+ (* (+ id 1) 3) bias)) forms))))))\n(define (wm-load-config)\n (load (string-append wm-fixture-root \"/root.scm\")))\n(define (wm-apply-config s id)\n (vector-set! s 7 wm-config-generation)\n (wm-loaded-policy s id)\n (wm-key s wm-active-keys (modulo id 8) (modulo (quotient id 8) 4) id))\n\n(define (wm-score s)\n (let ((initial (let state ((i 1) (hash 19))\n (if (= i 10) hash (state (+ i 1) (modulo (+ (* hash 33) (vector-ref s i)) wm-modulus))))))\n (let clients ((id 0) (hash initial))\n (if (= id 64) hash\n (let ((c (vector-ref (vector-ref s 0) id)))\n (clients (+ id 1)\n (if c\n (let fields ((i 0) (h hash))\n (if (= i 7) h (fields (+ i 1) (modulo (+ (* h 33) (vector-ref c i)) wm-modulus))))\n (modulo (+ (* hash 33) 257) wm-modulus))))))))\n\n(define (benchmark seed)\n (let ((s (wm-new seed)) )\n \n (let loop ((i 0))\n (if (< i (+ 8 seed)) (begin (let ((keys (eval (wm-macro-form (+ seed i)) wm-config-environment)))\n (set! wm-active-keys keys)\n (let apply ((entries keys) (id 0))\n (if (pair? entries)\n (begin ((cdr (car entries)) s (modulo (+ id seed) 64))\n (apply (cdr entries) (+ id 1)))))\n (vector-set! s 7 (+ (vector-ref s 7) 1))) (loop (+ i 1)))))\n (wm-score s)))", "expected": 28455489, "expected_by_seed": [ 28455489, 792287260, 447879178, 114021731 ], "batch_calls": 4, "warmup_calls": 5, "source": "bench/wm/wm-macro-config.scm", "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))", "guile_setup": "(define-module (vile benchmarks wm-macro-config) #:use-module (guile))\n(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (current-module))", "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.", "source_sha256": "d194536bd1a2254feecbccde30f1e056bfb403d0b346d2f069cb5f7629cd1ea7" }, { "name": "wm-config-load-tree", "category": "loading", "definitions": ";; A deterministic headless WM. Clients are [id workspace x y width height flags].\n;; State is [clients focus workspace ticks commands geometry managed config hooks seed].\n(define wm-modulus 1000000007)\n(define wm-config-generation 0)\n(define wm-active-keys '())\n(define wm-loaded-policy (lambda (s id) #f))\n\n(define (wm-new seed)\n (let ((clients (make-vector 64 #f)))\n (let loop ((id 0))\n (if (< id 64)\n (begin (vector-set! clients id (vector id (modulo id 4) 0 0 0 0 1))\n (loop (+ id 1)))))\n (vector clients (modulo seed 64) (modulo seed 4) 0 0 0 64 0 0 seed)))\n\n(define (wm-command s id code)\n (vector-set! s 4 (modulo (+ (* (vector-ref s 4) 17) (* id 3) code) wm-modulus))\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client (vector-set! client 6 (modulo (+ (vector-ref client 6) code) 256))))\n code)\n\n(define (wm-focus s start)\n (let ((clients (vector-ref s 0)) (workspace (vector-ref s 2)))\n (let loop ((left 64) (id (modulo start 64)))\n (if (= left 0) (vector-set! s 1 -1)\n (let ((client (vector-ref clients id)))\n (if (and client (= (vector-ref client 1) workspace)) (vector-set! s 1 id)\n (loop (- left 1) (modulo (+ id 1) 64))))))))\n\n(define (wm-switch s workspace)\n (vector-set! s 2 (modulo workspace 4))\n (wm-focus s (+ (vector-ref s 1) 1)))\n\n(define (wm-move s id workspace)\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client\n (begin (vector-set! client 1 (modulo workspace 4))\n (if (and (= id (vector-ref s 1)) (not (= (vector-ref client 1) (vector-ref s 2))))\n (wm-focus s (+ id 1))))))\n (wm-command s id 3))\n\n(define (wm-map s id workspace)\n (let ((clients (vector-ref s 0)))\n (if (not (vector-ref clients id)) (vector-set! s 6 (+ 1 (vector-ref s 6))))\n (vector-set! clients id (vector id (modulo workspace 4) 0 0 0 0 1))))\n\n(define (wm-unmap s id)\n (let ((clients (vector-ref s 0)))\n (if (vector-ref clients id)\n (begin (vector-set! clients id #f) (vector-set! s 6 (- (vector-ref s 6) 1)))))\n (if (= id (vector-ref s 1)) (wm-focus s (+ id 1))))\n\n(define (wm-layout s frame)\n (let* ((clients (vector-ref s 0)) (workspace (vector-ref s 2))\n (width (+ 1280 (* 8 (vector-ref s 9)))) (gap (+ 4 (modulo (vector-ref s 7) 5)))\n (master (quotient (* width 3) 5))\n (count (let scan ((id 0) (n 0))\n (if (= id 64) n\n (let ((c (vector-ref clients id)))\n (scan (+ id 1) (if (and c (= (vector-ref c 1) workspace)) (+ n 1) n)))))))\n (let place ((id 0) (rank 0))\n (if (< id 64)\n (let ((c (vector-ref clients id)))\n (if (and c (= (vector-ref c 1) workspace))\n (begin\n (if (or (= count 1) (= (modulo frame 2) 1))\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- width (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (if (= rank 0)\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- master (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (let ((height (quotient 720 (- count 1))))\n (vector-set! c 2 (+ master gap)) (vector-set! c 3 (+ gap (* (- rank 1) height)))\n (vector-set! c 4 (- width master (* 2 gap))) (vector-set! c 5 (- height (* 2 gap))))))\n (place (+ id 1) (+ rank 1)))\n (place (+ id 1) rank)))))\n (vector-set! s 5 (modulo (+ (vector-ref s 5) (* count 97) frame) wm-modulus))))\n\n(define wm-dispatch\n (vector (lambda(s id p)(wm-focus s id)) (lambda(s id p)(wm-switch s p))\n (lambda(s id p)(wm-move s id p)) (lambda(s id p)(wm-command s id p))\n (lambda(s id p)(wm-layout s p)) (lambda(s id p)(wm-map s id p))\n (lambda(s id p)(wm-unmap s id))\n (lambda(s id p)(vector-set! s 8 (+ (vector-ref s 8) p)))))\n\n(define (wm-event s kind id payload)\n (vector-set! s 3 (+ (vector-ref s 3) 1))\n ((vector-ref wm-dispatch kind) s id payload))\n\n(define (wm-leaf s id code) (wm-command s id code) (+ code 1))\n(define (wm-one s id code) (wm-leaf s id (+ code 1)))\n(define (wm-two s id code) (wm-one s id (+ code 1)))\n(define (wm-three s id code) (wm-two s id (+ code 1)))\n(define (wm-four s id code) (wm-three s id (+ code 1)))\n(define (wm-callback bias) (lambda(s id code)(wm-four s id (+ code bias))))\n(define (wm-invoke callback s id code) (callback s id code))\n\n(define-syntax wm-binding\n (syntax-rules () ((_ key modifiers action) (cons (cons key modifiers) action))))\n(define-syntax wm-keyset\n (syntax-rules () ((_ (key modifiers code) ...)\n (list (wm-binding key modifiers (wm-action code)) ...))))\n(define (wm-action code) (lambda(s id)(wm-command s id code)))\n(define (wm-keymap bias)\n (let loop ((id 31) (keys '()))\n (if (< id 0) keys\n (loop (- id 1) (cons (wm-binding (modulo id 8) (quotient id 8)\n (wm-action (+ (* (+ id 1) 3) bias))) keys)))))\n(define (wm-key s keys key modifiers id)\n (let ((binding (assoc (cons key modifiers) keys)))\n (if binding ((cdr binding) s id))))\n\n(define (wm-hook tag)\n (let ((count 0))\n (lambda(s id code)\n (set! count (+ count 1))\n (wm-command s id (+ tag code count))\n (vector-set! s 8 (+ (vector-ref s 8) count))\n (= (modulo code (+ tag 2)) 0))))\n(define (wm-deliver hooks s id code)\n (if (pair? hooks)\n (if (not ((car hooks) s id code)) (wm-deliver (cdr hooks) s id code))))\n\n(define (wm-macro-form bias)\n (cons 'wm-keyset\n (let loop ((id 31) (forms '()))\n (if (< id 0) forms\n (loop (- id 1) (cons (list (modulo id 8) (quotient id 8) (+ (* (+ id 1) 3) bias)) forms))))))\n(define (wm-load-config)\n (load (string-append wm-fixture-root \"/root.scm\")))\n(define (wm-apply-config s id)\n (vector-set! s 7 wm-config-generation)\n (wm-loaded-policy s id)\n (wm-key s wm-active-keys (modulo id 8) (modulo (quotient id 8) 4) id))\n\n(define (wm-score s)\n (let ((initial (let state ((i 1) (hash 19))\n (if (= i 10) hash (state (+ i 1) (modulo (+ (* hash 33) (vector-ref s i)) wm-modulus))))))\n (let clients ((id 0) (hash initial))\n (if (= id 64) hash\n (let ((c (vector-ref (vector-ref s 0) id)))\n (clients (+ id 1)\n (if c\n (let fields ((i 0) (h hash))\n (if (= i 7) h (fields (+ i 1) (modulo (+ (* h 33) (vector-ref c i)) wm-modulus))))\n (modulo (+ (* hash 33) 257) wm-modulus))))))))\n\n(define (benchmark seed)\n (let ((s (wm-new seed)) )\n (set! wm-config-generation 0) (set! wm-active-keys '())\n (let loop ((i 0))\n (if (< i (+ 4 seed)) (begin (wm-load-config)\n (let apply ((id 0))\n (if (< id 16) (begin (wm-apply-config s id) (apply (+ id 1))))) (loop (+ i 1)))))\n (wm-score s)))", "expected": 67320864, "expected_by_seed": [ 67320864, 617068141, 636911275, 864953258 ], "batch_calls": 4, "warmup_calls": 5, "source": "bench/wm/wm-config-load-tree.scm", "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))", "guile_setup": "(define-module (vile benchmarks wm-config-load-tree) #:use-module (guile))\n(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (current-module))", "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.", "source_sha256": "37f3adcbc1a16376d71c291f523383e972a5d71477f8fc41b7dafd60bd3e9efe" }, { "name": "wm-reload-live", "category": "loading", "definitions": ";; A deterministic headless WM. Clients are [id workspace x y width height flags].\n;; State is [clients focus workspace ticks commands geometry managed config hooks seed].\n(define wm-modulus 1000000007)\n(define wm-config-generation 0)\n(define wm-active-keys '())\n(define wm-loaded-policy (lambda (s id) #f))\n\n(define (wm-new seed)\n (let ((clients (make-vector 64 #f)))\n (let loop ((id 0))\n (if (< id 64)\n (begin (vector-set! clients id (vector id (modulo id 4) 0 0 0 0 1))\n (loop (+ id 1)))))\n (vector clients (modulo seed 64) (modulo seed 4) 0 0 0 64 0 0 seed)))\n\n(define (wm-command s id code)\n (vector-set! s 4 (modulo (+ (* (vector-ref s 4) 17) (* id 3) code) wm-modulus))\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client (vector-set! client 6 (modulo (+ (vector-ref client 6) code) 256))))\n code)\n\n(define (wm-focus s start)\n (let ((clients (vector-ref s 0)) (workspace (vector-ref s 2)))\n (let loop ((left 64) (id (modulo start 64)))\n (if (= left 0) (vector-set! s 1 -1)\n (let ((client (vector-ref clients id)))\n (if (and client (= (vector-ref client 1) workspace)) (vector-set! s 1 id)\n (loop (- left 1) (modulo (+ id 1) 64))))))))\n\n(define (wm-switch s workspace)\n (vector-set! s 2 (modulo workspace 4))\n (wm-focus s (+ (vector-ref s 1) 1)))\n\n(define (wm-move s id workspace)\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client\n (begin (vector-set! client 1 (modulo workspace 4))\n (if (and (= id (vector-ref s 1)) (not (= (vector-ref client 1) (vector-ref s 2))))\n (wm-focus s (+ id 1))))))\n (wm-command s id 3))\n\n(define (wm-map s id workspace)\n (let ((clients (vector-ref s 0)))\n (if (not (vector-ref clients id)) (vector-set! s 6 (+ 1 (vector-ref s 6))))\n (vector-set! clients id (vector id (modulo workspace 4) 0 0 0 0 1))))\n\n(define (wm-unmap s id)\n (let ((clients (vector-ref s 0)))\n (if (vector-ref clients id)\n (begin (vector-set! clients id #f) (vector-set! s 6 (- (vector-ref s 6) 1)))))\n (if (= id (vector-ref s 1)) (wm-focus s (+ id 1))))\n\n(define (wm-layout s frame)\n (let* ((clients (vector-ref s 0)) (workspace (vector-ref s 2))\n (width (+ 1280 (* 8 (vector-ref s 9)))) (gap (+ 4 (modulo (vector-ref s 7) 5)))\n (master (quotient (* width 3) 5))\n (count (let scan ((id 0) (n 0))\n (if (= id 64) n\n (let ((c (vector-ref clients id)))\n (scan (+ id 1) (if (and c (= (vector-ref c 1) workspace)) (+ n 1) n)))))))\n (let place ((id 0) (rank 0))\n (if (< id 64)\n (let ((c (vector-ref clients id)))\n (if (and c (= (vector-ref c 1) workspace))\n (begin\n (if (or (= count 1) (= (modulo frame 2) 1))\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- width (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (if (= rank 0)\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- master (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (let ((height (quotient 720 (- count 1))))\n (vector-set! c 2 (+ master gap)) (vector-set! c 3 (+ gap (* (- rank 1) height)))\n (vector-set! c 4 (- width master (* 2 gap))) (vector-set! c 5 (- height (* 2 gap))))))\n (place (+ id 1) (+ rank 1)))\n (place (+ id 1) rank)))))\n (vector-set! s 5 (modulo (+ (vector-ref s 5) (* count 97) frame) wm-modulus))))\n\n(define wm-dispatch\n (vector (lambda(s id p)(wm-focus s id)) (lambda(s id p)(wm-switch s p))\n (lambda(s id p)(wm-move s id p)) (lambda(s id p)(wm-command s id p))\n (lambda(s id p)(wm-layout s p)) (lambda(s id p)(wm-map s id p))\n (lambda(s id p)(wm-unmap s id))\n (lambda(s id p)(vector-set! s 8 (+ (vector-ref s 8) p)))))\n\n(define (wm-event s kind id payload)\n (vector-set! s 3 (+ (vector-ref s 3) 1))\n ((vector-ref wm-dispatch kind) s id payload))\n\n(define (wm-leaf s id code) (wm-command s id code) (+ code 1))\n(define (wm-one s id code) (wm-leaf s id (+ code 1)))\n(define (wm-two s id code) (wm-one s id (+ code 1)))\n(define (wm-three s id code) (wm-two s id (+ code 1)))\n(define (wm-four s id code) (wm-three s id (+ code 1)))\n(define (wm-callback bias) (lambda(s id code)(wm-four s id (+ code bias))))\n(define (wm-invoke callback s id code) (callback s id code))\n\n(define-syntax wm-binding\n (syntax-rules () ((_ key modifiers action) (cons (cons key modifiers) action))))\n(define-syntax wm-keyset\n (syntax-rules () ((_ (key modifiers code) ...)\n (list (wm-binding key modifiers (wm-action code)) ...))))\n(define (wm-action code) (lambda(s id)(wm-command s id code)))\n(define (wm-keymap bias)\n (let loop ((id 31) (keys '()))\n (if (< id 0) keys\n (loop (- id 1) (cons (wm-binding (modulo id 8) (quotient id 8)\n (wm-action (+ (* (+ id 1) 3) bias))) keys)))))\n(define (wm-key s keys key modifiers id)\n (let ((binding (assoc (cons key modifiers) keys)))\n (if binding ((cdr binding) s id))))\n\n(define (wm-hook tag)\n (let ((count 0))\n (lambda(s id code)\n (set! count (+ count 1))\n (wm-command s id (+ tag code count))\n (vector-set! s 8 (+ (vector-ref s 8) count))\n (= (modulo code (+ tag 2)) 0))))\n(define (wm-deliver hooks s id code)\n (if (pair? hooks)\n (if (not ((car hooks) s id code)) (wm-deliver (cdr hooks) s id code))))\n\n(define (wm-macro-form bias)\n (cons 'wm-keyset\n (let loop ((id 31) (forms '()))\n (if (< id 0) forms\n (loop (- id 1) (cons (list (modulo id 8) (quotient id 8) (+ (* (+ id 1) 3) bias)) forms))))))\n(define (wm-load-config)\n (load (string-append wm-fixture-root \"/root.scm\")))\n(define (wm-apply-config s id)\n (vector-set! s 7 wm-config-generation)\n (wm-loaded-policy s id)\n (wm-key s wm-active-keys (modulo id 8) (modulo (quotient id 8) 4) id))\n\n(define (wm-score s)\n (let ((initial (let state ((i 1) (hash 19))\n (if (= i 10) hash (state (+ i 1) (modulo (+ (* hash 33) (vector-ref s i)) wm-modulus))))))\n (let clients ((id 0) (hash initial))\n (if (= id 64) hash\n (let ((c (vector-ref (vector-ref s 0) id)))\n (clients (+ id 1)\n (if c\n (let fields ((i 0) (h hash))\n (if (= i 7) h (fields (+ i 1) (modulo (+ (* h 33) (vector-ref c i)) wm-modulus))))\n (modulo (+ (* hash 33) 257) wm-modulus))))))))\n\n(define (benchmark seed)\n (let ((s (wm-new seed)) (hooks (list (wm-hook 1) (wm-hook 2) (wm-hook 3) (wm-hook 4))))\n (set! wm-config-generation 0) (set! wm-active-keys '()) (set! wm-loaded-policy (lambda(s id)#f))\n (let loop ((i 0))\n (if (< i (+ 512 (* 8 seed))) (begin \n (let ((id (modulo (+ (* i 13) seed) 64)) (payload (modulo (+ (* i 7) seed) 97)))\n (if (= (modulo i 128) 0)\n (let ((previous wm-loaded-policy))\n (wm-load-config) (wm-apply-config s id) (previous s id)))\n (wm-event s (modulo (+ (* i 5) seed) 8) id payload)\n ) (loop (+ i 1)))))\n (wm-score s)))", "expected": 581483586, "expected_by_seed": [ 581483586, 266521831, 779533641, 339751311 ], "batch_calls": 4, "warmup_calls": 5, "source": "bench/wm/wm-reload-live.scm", "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))", "guile_setup": "(define-module (vile benchmarks wm-reload-live) #:use-module (guile))\n(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (current-module))", "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.", "source_sha256": "db573e93dae4cc59b17d4048646462acbfcdebc78698c15f6dcfa9bf018d6de3" }, { "name": "wm-session-replay", "category": "integrated", "definitions": ";; A deterministic headless WM. Clients are [id workspace x y width height flags].\n;; State is [clients focus workspace ticks commands geometry managed config hooks seed].\n(define wm-modulus 1000000007)\n(define wm-config-generation 0)\n(define wm-active-keys '())\n(define wm-loaded-policy (lambda (s id) #f))\n\n(define (wm-new seed)\n (let ((clients (make-vector 64 #f)))\n (let loop ((id 0))\n (if (< id 64)\n (begin (vector-set! clients id (vector id (modulo id 4) 0 0 0 0 1))\n (loop (+ id 1)))))\n (vector clients (modulo seed 64) (modulo seed 4) 0 0 0 64 0 0 seed)))\n\n(define (wm-command s id code)\n (vector-set! s 4 (modulo (+ (* (vector-ref s 4) 17) (* id 3) code) wm-modulus))\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client (vector-set! client 6 (modulo (+ (vector-ref client 6) code) 256))))\n code)\n\n(define (wm-focus s start)\n (let ((clients (vector-ref s 0)) (workspace (vector-ref s 2)))\n (let loop ((left 64) (id (modulo start 64)))\n (if (= left 0) (vector-set! s 1 -1)\n (let ((client (vector-ref clients id)))\n (if (and client (= (vector-ref client 1) workspace)) (vector-set! s 1 id)\n (loop (- left 1) (modulo (+ id 1) 64))))))))\n\n(define (wm-switch s workspace)\n (vector-set! s 2 (modulo workspace 4))\n (wm-focus s (+ (vector-ref s 1) 1)))\n\n(define (wm-move s id workspace)\n (let ((client (vector-ref (vector-ref s 0) id)))\n (if client\n (begin (vector-set! client 1 (modulo workspace 4))\n (if (and (= id (vector-ref s 1)) (not (= (vector-ref client 1) (vector-ref s 2))))\n (wm-focus s (+ id 1))))))\n (wm-command s id 3))\n\n(define (wm-map s id workspace)\n (let ((clients (vector-ref s 0)))\n (if (not (vector-ref clients id)) (vector-set! s 6 (+ 1 (vector-ref s 6))))\n (vector-set! clients id (vector id (modulo workspace 4) 0 0 0 0 1))))\n\n(define (wm-unmap s id)\n (let ((clients (vector-ref s 0)))\n (if (vector-ref clients id)\n (begin (vector-set! clients id #f) (vector-set! s 6 (- (vector-ref s 6) 1)))))\n (if (= id (vector-ref s 1)) (wm-focus s (+ id 1))))\n\n(define (wm-layout s frame)\n (let* ((clients (vector-ref s 0)) (workspace (vector-ref s 2))\n (width (+ 1280 (* 8 (vector-ref s 9)))) (gap (+ 4 (modulo (vector-ref s 7) 5)))\n (master (quotient (* width 3) 5))\n (count (let scan ((id 0) (n 0))\n (if (= id 64) n\n (let ((c (vector-ref clients id)))\n (scan (+ id 1) (if (and c (= (vector-ref c 1) workspace)) (+ n 1) n)))))))\n (let place ((id 0) (rank 0))\n (if (< id 64)\n (let ((c (vector-ref clients id)))\n (if (and c (= (vector-ref c 1) workspace))\n (begin\n (if (or (= count 1) (= (modulo frame 2) 1))\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- width (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (if (= rank 0)\n (begin (vector-set! c 2 gap) (vector-set! c 3 gap)\n (vector-set! c 4 (- master (* 2 gap))) (vector-set! c 5 (- 720 (* 2 gap))))\n (let ((height (quotient 720 (- count 1))))\n (vector-set! c 2 (+ master gap)) (vector-set! c 3 (+ gap (* (- rank 1) height)))\n (vector-set! c 4 (- width master (* 2 gap))) (vector-set! c 5 (- height (* 2 gap))))))\n (place (+ id 1) (+ rank 1)))\n (place (+ id 1) rank)))))\n (vector-set! s 5 (modulo (+ (vector-ref s 5) (* count 97) frame) wm-modulus))))\n\n(define wm-dispatch\n (vector (lambda(s id p)(wm-focus s id)) (lambda(s id p)(wm-switch s p))\n (lambda(s id p)(wm-move s id p)) (lambda(s id p)(wm-command s id p))\n (lambda(s id p)(wm-layout s p)) (lambda(s id p)(wm-map s id p))\n (lambda(s id p)(wm-unmap s id))\n (lambda(s id p)(vector-set! s 8 (+ (vector-ref s 8) p)))))\n\n(define (wm-event s kind id payload)\n (vector-set! s 3 (+ (vector-ref s 3) 1))\n ((vector-ref wm-dispatch kind) s id payload))\n\n(define (wm-leaf s id code) (wm-command s id code) (+ code 1))\n(define (wm-one s id code) (wm-leaf s id (+ code 1)))\n(define (wm-two s id code) (wm-one s id (+ code 1)))\n(define (wm-three s id code) (wm-two s id (+ code 1)))\n(define (wm-four s id code) (wm-three s id (+ code 1)))\n(define (wm-callback bias) (lambda(s id code)(wm-four s id (+ code bias))))\n(define (wm-invoke callback s id code) (callback s id code))\n\n(define-syntax wm-binding\n (syntax-rules () ((_ key modifiers action) (cons (cons key modifiers) action))))\n(define-syntax wm-keyset\n (syntax-rules () ((_ (key modifiers code) ...)\n (list (wm-binding key modifiers (wm-action code)) ...))))\n(define (wm-action code) (lambda(s id)(wm-command s id code)))\n(define (wm-keymap bias)\n (let loop ((id 31) (keys '()))\n (if (< id 0) keys\n (loop (- id 1) (cons (wm-binding (modulo id 8) (quotient id 8)\n (wm-action (+ (* (+ id 1) 3) bias))) keys)))))\n(define (wm-key s keys key modifiers id)\n (let ((binding (assoc (cons key modifiers) keys)))\n (if binding ((cdr binding) s id))))\n\n(define (wm-hook tag)\n (let ((count 0))\n (lambda(s id code)\n (set! count (+ count 1))\n (wm-command s id (+ tag code count))\n (vector-set! s 8 (+ (vector-ref s 8) count))\n (= (modulo code (+ tag 2)) 0))))\n(define (wm-deliver hooks s id code)\n (if (pair? hooks)\n (if (not ((car hooks) s id code)) (wm-deliver (cdr hooks) s id code))))\n\n(define (wm-macro-form bias)\n (cons 'wm-keyset\n (let loop ((id 31) (forms '()))\n (if (< id 0) forms\n (loop (- id 1) (cons (list (modulo id 8) (quotient id 8) (+ (* (+ id 1) 3) bias)) forms))))))\n(define (wm-load-config)\n (load (string-append wm-fixture-root \"/root.scm\")))\n(define (wm-apply-config s id)\n (vector-set! s 7 wm-config-generation)\n (wm-loaded-policy s id)\n (wm-key s wm-active-keys (modulo id 8) (modulo (quotient id 8) 4) id))\n\n(define (wm-score s)\n (let ((initial (let state ((i 1) (hash 19))\n (if (= i 10) hash (state (+ i 1) (modulo (+ (* hash 33) (vector-ref s i)) wm-modulus))))))\n (let clients ((id 0) (hash initial))\n (if (= id 64) hash\n (let ((c (vector-ref (vector-ref s 0) id)))\n (clients (+ id 1)\n (if c\n (let fields ((i 0) (h hash))\n (if (= i 7) h (fields (+ i 1) (modulo (+ (* h 33) (vector-ref c i)) wm-modulus))))\n (modulo (+ (* hash 33) 257) wm-modulus))))))))\n\n(define (benchmark seed)\n (let ((s (wm-new seed)) (hooks (list (wm-hook 1) (wm-hook 2) (wm-hook 3) (wm-hook 4))))\n (set! wm-config-generation 0) (set! wm-active-keys '()) (set! wm-loaded-policy (lambda(s id)#f))\n (let loop ((i 0))\n (if (< i (+ 256 (* 8 seed))) (begin \n (let ((id (modulo (+ (* i 13) seed) 64)) (payload (modulo (+ (* i 7) seed) 97)))\n (if (= (modulo i 64) 0)\n (let ((previous wm-loaded-policy))\n (wm-load-config) (wm-apply-config s id) (previous s id)))\n (wm-event s (modulo (+ (* i 5) seed) 8) id payload)\n (if (= (modulo i 5) 0)\n (wm-key s wm-active-keys (modulo id 8) (modulo (quotient id 8) 4) id))\n (if (= (modulo i 16) 0) (wm-layout s i))\n (if (= (modulo i 7) 0) (wm-deliver hooks s id (modulo payload 13)))) (loop (+ i 1)))))\n (wm-score s)))", "expected": 800133373, "expected_by_seed": [ 800133373, 320868980, 972790673, 922084893 ], "batch_calls": 4, "warmup_calls": 5, "source": "bench/wm/wm-session-replay.scm", "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))", "guile_setup": "(define-module (vile benchmarks wm-session-replay) #:use-module (guile))\n(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (current-module))", "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.", "source_sha256": "4f84eab25babd7b0112b99721a6ab3a4c232caa4728b8d780a5996d44b7a8f98" } ], "original_cases_path": "bench/wm/model.py", "original_cases_sha256": "634b1d942f3b475569d56089efc1cffdcb39b7c0e7f849af99a75b233a52be53", "dependencies": { "bench/wm/common.scm": "b52c75b5fdab2afa2d13a7f2badb7b6d09ee37ead10f7c8eba306a324978e0f9", "bench/wm/model.py": "634b1d942f3b475569d56089efc1cffdcb39b7c0e7f849af99a75b233a52be53", "bench/wm/workloads.py": "81f24386efb4524e0d9e968c46337a532f3600a9861aaaab772b003bd1d66be6", "bench/wm/fixtures/bindings.scm": "98efca46341e10d2c423670f358851155dde1df048c0eb55856313db6ce92da9", "bench/wm/fixtures/policy.scm": "41b510b070eaf48e83a00ed4253a6ffe9a7ea353db519cd45c7a7750eb93c51e", "bench/wm/fixtures/root.scm": "97436dafa697e15776bb2533b457ef50ace7a658d34d75a4cd5e367128065375", "bench/wm/fixtures/rules.scm": "89c63acbd79bf2ce9f28d3df8af8de8bdbb0fd16480d735fccc933afac52da76" } }