vile / bench / wm / cases.json
251 lines · 251 sloc · 90.37 KB · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw
1{
2 "schema_version": 3,
3 "suite": "mock-window-manager-v1",
4 "seed_values": [
5 0,
6 1,
7 2,
8 3
9 ],
10 "cases": [
11 {
12 "name": "wm-callback-chain",
13 "category": "calls",
14 "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)))",
15 "expected": 335333945,
16 "expected_by_seed": [
17 335333945,
18 367417536,
19 846886949,
20 836297807
21 ],
22 "batch_calls": 4,
23 "warmup_calls": 5,
24 "source": "bench/wm/wm-callback-chain.scm",
25 "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))",
26 "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))",
27 "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.",
28 "source_sha256": "0703fe76b22e55f26da50e5d6aa61a6a51de3f29d9774a380c24178d5d7649c6"
29 },
30 {
31 "name": "wm-event-dispatch",
32 "category": "events",
33 "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)))",
34 "expected": 351739486,
35 "expected_by_seed": [
36 351739486,
37 797219635,
38 357458806,
39 520751872
40 ],
41 "batch_calls": 4,
42 "warmup_calls": 5,
43 "source": "bench/wm/wm-event-dispatch.scm",
44 "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))",
45 "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))",
46 "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.",
47 "source_sha256": "4a14634938f45ec524ae328018e0a237e3f6e0200361eff76339e4901e833ffc"
48 },
49 {
50 "name": "wm-focus-cycle",
51 "category": "state",
52 "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)))",
53 "expected": 535297483,
54 "expected_by_seed": [
55 535297483,
56 51001866,
57 281514363,
58 526295355
59 ],
60 "batch_calls": 4,
61 "warmup_calls": 5,
62 "source": "bench/wm/wm-focus-cycle.scm",
63 "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))",
64 "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))",
65 "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.",
66 "source_sha256": "c3bc6c5de68cb4a24904e34c8af01c5c60912f413471f644a958a913356c2793"
67 },
68 {
69 "name": "wm-tiling-layout",
70 "category": "layout",
71 "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)))",
72 "expected": 239122862,
73 "expected_by_seed": [
74 239122862,
75 503413128,
76 970299409,
77 151603935
78 ],
79 "batch_calls": 4,
80 "warmup_calls": 5,
81 "source": "bench/wm/wm-tiling-layout.scm",
82 "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))",
83 "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))",
84 "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.",
85 "source_sha256": "a2eb44cdfd89e4b901110b31d92811651eabdf138479a2f6a967d11f52b3de67"
86 },
87 {
88 "name": "wm-workspace-move",
89 "category": "state",
90 "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)))",
91 "expected": 944497161,
92 "expected_by_seed": [
93 944497161,
94 402600027,
95 341068392,
96 211255284
97 ],
98 "batch_calls": 4,
99 "warmup_calls": 5,
100 "source": "bench/wm/wm-workspace-move.scm",
101 "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))",
102 "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))",
103 "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.",
104 "source_sha256": "b6fca65145ec75237cf547a309ef8d21299eadbaf22d2ce89cc9308b135c5cf1"
105 },
106 {
107 "name": "wm-keybindings",
108 "category": "calls",
109 "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)))",
110 "expected": 494793665,
111 "expected_by_seed": [
112 494793665,
113 420630214,
114 517122330,
115 377293159
116 ],
117 "batch_calls": 4,
118 "warmup_calls": 5,
119 "source": "bench/wm/wm-keybindings.scm",
120 "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))",
121 "guile_setup": "(define-module (vile benchmarks wm-keybindings) #:use-module (guile))\n(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (current-module))",
122 "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.",
123 "source_sha256": "4971e869e3a789eb05e14d44b2d458dcfeb12d03ec9bf854bc07983f1a52b367"
124 },
125 {
126 "name": "wm-hooks",
127 "category": "calls",
128 "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)))",
129 "expected": 261284825,
130 "expected_by_seed": [
131 261284825,
132 226339409,
133 836561432,
134 183419363
135 ],
136 "batch_calls": 4,
137 "warmup_calls": 5,
138 "source": "bench/wm/wm-hooks.scm",
139 "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))",
140 "guile_setup": "(define-module (vile benchmarks wm-hooks) #:use-module (guile))\n(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (current-module))",
141 "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.",
142 "source_sha256": "06de2d71f02670ccb1a6bf9b95df6ce82a1d4cba53b03f1581a65be34efe56e8"
143 },
144 {
145 "name": "wm-lifecycle",
146 "category": "allocation",
147 "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)))",
148 "expected": 848383737,
149 "expected_by_seed": [
150 848383737,
151 720750568,
152 310968481,
153 357222457
154 ],
155 "batch_calls": 4,
156 "warmup_calls": 5,
157 "source": "bench/wm/wm-lifecycle.scm",
158 "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))",
159 "guile_setup": "(define-module (vile benchmarks wm-lifecycle) #:use-module (guile))\n(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (current-module))",
160 "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.",
161 "source_sha256": "2454d01f95191179f045aebffe8a67852b46a606ace10899fb662e62359f87d2"
162 },
163 {
164 "name": "wm-macro-config",
165 "category": "expansion",
166 "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)))",
167 "expected": 28455489,
168 "expected_by_seed": [
169 28455489,
170 792287260,
171 447879178,
172 114021731
173 ],
174 "batch_calls": 4,
175 "warmup_calls": 5,
176 "source": "bench/wm/wm-macro-config.scm",
177 "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))",
178 "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))",
179 "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.",
180 "source_sha256": "d194536bd1a2254feecbccde30f1e056bfb403d0b346d2f069cb5f7629cd1ea7"
181 },
182 {
183 "name": "wm-config-load-tree",
184 "category": "loading",
185 "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)))",
186 "expected": 67320864,
187 "expected_by_seed": [
188 67320864,
189 617068141,
190 636911275,
191 864953258
192 ],
193 "batch_calls": 4,
194 "warmup_calls": 5,
195 "source": "bench/wm/wm-config-load-tree.scm",
196 "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))",
197 "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))",
198 "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.",
199 "source_sha256": "37f3adcbc1a16376d71c291f523383e972a5d71477f8fc41b7dafd60bd3e9efe"
200 },
201 {
202 "name": "wm-reload-live",
203 "category": "loading",
204 "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)))",
205 "expected": 581483586,
206 "expected_by_seed": [
207 581483586,
208 266521831,
209 779533641,
210 339751311
211 ],
212 "batch_calls": 4,
213 "warmup_calls": 5,
214 "source": "bench/wm/wm-reload-live.scm",
215 "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))",
216 "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))",
217 "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.",
218 "source_sha256": "db573e93dae4cc59b17d4048646462acbfcdebc78698c15f6dcfa9bf018d6de3"
219 },
220 {
221 "name": "wm-session-replay",
222 "category": "integrated",
223 "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)))",
224 "expected": 800133373,
225 "expected_by_seed": [
226 800133373,
227 320868980,
228 972790673,
229 922084893
230 ],
231 "batch_calls": 4,
232 "warmup_calls": 5,
233 "source": "bench/wm/wm-session-replay.scm",
234 "vile_setup": "(define wm-fixture-root @FIXTURE_ROOT@) (define wm-config-environment (interaction-environment))",
235 "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))",
236 "oracle": "Independent Python dictionary-state model checks every state field and client geometry through the common checksum protocol.",
237 "source_sha256": "4f84eab25babd7b0112b99721a6ab3a4c232caa4728b8d780a5996d44b7a8f98"
238 }
239 ],
240 "original_cases_path": "bench/wm/model.py",
241 "original_cases_sha256": "634b1d942f3b475569d56089efc1cffdcb39b7c0e7f849af99a75b233a52be53",
242 "dependencies": {
243 "bench/wm/common.scm": "b52c75b5fdab2afa2d13a7f2badb7b6d09ee37ead10f7c8eba306a324978e0f9",
244 "bench/wm/model.py": "634b1d942f3b475569d56089efc1cffdcb39b7c0e7f849af99a75b233a52be53",
245 "bench/wm/workloads.py": "81f24386efb4524e0d9e968c46337a532f3600a9861aaaab772b003bd1d66be6",
246 "bench/wm/fixtures/bindings.scm": "98efca46341e10d2c423670f358851155dde1df048c0eb55856313db6ce92da9",
247 "bench/wm/fixtures/policy.scm": "41b510b070eaf48e83a00ed4253a6ffe9a7ea353db519cd45c7a7750eb93c51e",
248 "bench/wm/fixtures/root.scm": "97436dafa697e15776bb2533b457ef50ace7a658d34d75a4cd5e367128065375",
249 "bench/wm/fixtures/rules.scm": "89c63acbd79bf2ce9f28d3df8af8de8bdbb0fd16480d735fccc933afac52da76"
250 }
251}
252