all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#74748: Constructor created by define-configuration is slow (>25s) when many fields are defined
@ 2024-12-09 15:13 Tomas Volf
  2024-12-24 14:38 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Tomas Volf @ 2024-12-09 15:13 UTC (permalink / raw)
  To: 74748


[-- Attachment #1.1: Type: text/plain, Size: 1545 bytes --]


Hello,

I am writing a configuration for mpv and hit an issue of the generated
constructor (`home-mpv-configuration') is extremely slow.  While the
almost 800 fields is unusually high, initializing the instances of the
record should *not* take almost 30 seconds.  The full file is attached
to this email (as `mpv.scm').

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> ,use (gnu home services mpv)
scheme@(guix-user)> ,t (and (home-mpv-configuration (global (mpv-profile-configuration (fullscreen #t)))) #t)                                                                                  
$1 = #t
;; 29.615315s real time, 50.896973s run time.  24.031723s spent in GC.
--8<---------------cut here---------------end--------------->8---

Interestingly, profiling does not give us anything useful:

--8<---------------cut here---------------start------------->8---
scheme@(guix-user)> ,pr (and (home-mpv-configuration (global (mpv-profile-configuration (fullscreen #t)))) #t)                                                                                 
No samples recorded.
--8<---------------cut here---------------end--------------->8---

I also tried to remove all my custom sanitizers, to make sure the issue
is not in my code, but that did not help.

I took a short look, but code of both the define-configuration and of
Guix records is complex, full of syntax magic and I did not have any
luck trying to debug it myself.  Hence this report.

Have a nice day,
Tomas


[-- Attachment #1.2: Reproducer. --]
[-- Type: text/x-guile, Size: 121138 bytes --]

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2024 Tomas Volf <~@wolfsden.cz>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu home services mpv)
  #:use-module (gnu home services)
  #:use-module (gnu services configuration)
  #:use-module (guix gexp)
  #:use-module (ice-9 match)
  #:use-module (ice-9 regex)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-2)
  #:use-module (srfi srfi-26)
  #:use-module (srfi srfi-71)
  #:export (home-mpv-configuration
            home-mpv-configuration?
            home-mpv-configuration-global
            home-mpv-configuration-profiles
            home-mpv-configuration-extra
            home-mpv-configuration-source-location

            mpv-profile-configuration
            mpv-profile-configuration?
            mpv-profile-configuration-source-location
            ;; Generated exports - START.
            ;; Generated exports - END.
            ))

\f
;;;
;;; Basic types.
;;;
(define-maybe type/boolean)
(define (serialize-type/boolean field-name value)
  #~(string-append #$(symbol->string field-name)
                   "="
                   #$(if value "yes" "no")
                   "\n"))
(define type/boolean?
  (const #t))

(define-maybe type/integer)
(define (serialize-type/integer field-name value)
  #~(string-append #$(symbol->string field-name)
                   "="
                   #$(number->string value)
                   "\n"))
(define (type/integer? n)
  ;; We assume integer is a signed 32bit number.
  (and-let* (((integer? n))
             ((>= n -2147483648))
             ((<= n  2147483647)))))

(define-maybe type/integer64)
(define (serialize-type/integer64 field-name value)
  #~(string-append #$(symbol->string field-name)
                   "="
                   #$(number->string value)
                   "\n"))
(define (type/integer64? n)
  ;; We assume integer is a signed 64bit number.
  (and-let* (((integer? n))
             ((>= n -9223372036854775808))
             ((<= n  9223372036854775807)))))

(define-maybe type/string)
(define (serialize-type/string field-name value)
  #~(string-append #$(symbol->string field-name)
                   "="
                   #$value
                   "\n"))
(define type/string?
  string?)

(define-maybe type/float)
(define (serialize-type/float field-name value)
  #~(string-append #$(symbol->string field-name)
                   "="
                   #$(number->string (exact->inexact value))
                   "\n"))
(define type/float?
  ;; I am not sure how to validate floats.
  real?)

(define-maybe type/double)
(define (serialize-type/double field-name value)
  #~(string-append #$(symbol->string field-name)
                   "="
                   #$(number->string (exact->inexact value))
                   "\n"))
(define (type/double? value)
  ;; I am not sure how to validate doubles.
  real?)



\f
;;;
;;; Additional types (possible based on the basic ones).
;;;

;;; Aspect seems to be treated as an integer, so define it in terms of it.
(define-maybe type/aspect)
(define serialize-type/aspect serialize-type/integer)
(define type/aspect? type/integer?)

;;; `Audio channels or channel map' seems to be basically a free form string
;;; with no way to validate.
(define-maybe type/audio-channels-or-channel-map)
(define serialize-type/audio-channels-or-channel-map serialize-type/string)
(define type/audio-channels-or-channel-map? type/string?)

;;; Does not seem possible to validate.
(define-maybe type/audio-format)
(define serialize-type/audio-format serialize-type/string)
(define type/audio-format? type/string?)

;;; While most options list 4.6116860184274e+18 as a maximum value, we will
;;; use integer64 here.  That should be enough for everyone for few more
;;; years.
(define-maybe type/byte-size)
(define serialize-type/byte-size serialize-type/integer64)
(define type/byte-size? type/integer64?)

(define-maybe type/color)
(define (serialize-type/color field-name value)
  #~(string-append #$(symbol->string field-name)
                   "="
                   #$(if (list? value)
                         (string-join (map number->string value) "/")
                         value)
                   "\n"))
(define (type/color? value)
  (define (ok-num? n)
    (and (number? n)
         (>= n 0)
         (<= n 1)))
  (if (list? value)
      ;; Either a list of 3(4) numbers encoding RGB(A) on range from 0 to 1...
      (match value
        (((? ok-num? r) (? ok-num? g) (? ok-num? b))
         #t)
        (((? ok-num? r) (? ok-num? g) (? ok-num? b) (? ok-num? alpha))
         #t)
        (_
         #f))
      ;; ... or RGB(A) hex encoding.
      (string-match "^#([A-Fa-f0-9]{2})?[A-Fa-f0-9]{6}$" value)))

;;; I do not see value mirroring fourcc.org's database here.  It is further
;;; complicated by arbitrary hex being accepted as well.  So string it is.
(define-maybe type/fourcc)
(define serialize-type/fourcc serialize-type/string)
(define type/fourcc? type/string?)

;;; No way to validate.
(define-maybe type/image-format)
(define serialize-type/image-format serialize-type/string)
(define type/image-format? type/string?)

;;; Looking at the documentation for --start, there is no way to make this
;;; bullet-proof, especially since even chapter numbers are accepted.
(define-maybe type/relative-time-or-percent-position)
(define serialize-type/relative-time-or-percent-position serialize-type/string)
(define type/relative-time-or-percent-position? type/string?)

(define-maybe type/time)
(define serialize-type/time serialize-type/string)
(define type/time? type/string?)

(define-maybe type/video-rectangle)
(define serialize-type/video-rectangle serialize-type/string)
(define (type/video-rectangle? value)
  (or (string-match "-?[0-9]+%?:-?[0-9]+%?" value)
      (string-match
       "^(-?[0-9]+%?(x-?[0-9]+%?)?)?([+-]-?[0-9]+%?[+-]-?[0-9]+%?)?$"
       value)))

(define-maybe type/window-geometry)
(define serialize-type/window-geometry serialize-type/string)
(define (type/window-geometry? value)
  (or (string-match "-?[0-9]+%?:-?[0-9]+%?" value)
      (string-match
       "^(-?[0-9]+%?(x-?[0-9]+%?)?)?([+-]-?[0-9]+%?[+-]-?[0-9]+%?)?(/[0-9]+)?$"
       value)))

(define-maybe type/window-size)
(define serialize-type/window-size serialize-type/string)
(define (type/window-size? value)
  (string-match "^([0-9]+%?(x[0-9]+%?)?)?$" value))

(define-maybe type/enumeration)
(define (serialize-type/enumeration field-name value)
  #~(string-append #$(symbol->string field-name)
                   "="
                   ;; This could be either symbol or (in case of enumerations
                   ;; with alternate type) anything.  So just use `format'.
                   #$(format #f "~s" value)
                   "\n"))
(define (type/enumeration? value)
  ;; There is no general way to check enumerations.  The field always has to
  ;; define custom sanitizer.
  #t)



\f
;;;
;;; List types.
;;;
(define-maybe type/list-of-string)
(define (serialize-type/list-of-string field-name lst)
  #~(string-append #$(symbol->string field-name)
                   "="
                   #$(string-join lst ",")
                   "\n"))
(define (type/list-of-string? lst)
  (every type/string? lst))

(define-maybe type/list-of-key-value)
(define (serialize-type/list-of-key-value field-name lst)
  #~(string-append #$(symbol->string field-name)
                   "="
                   #$(string-join (map (match-lambda
                                         ((k . v) (format #f "~a=~a" k v)))
                                       lst)
                                  ",")
                   "\n"))
(define (type/list-of-key-value? lst)
  (every (match-lambda
           (((? string?) . (? string?)) #t)
           (_ #f))
         lst))

(define-maybe type/list-of-object-setting)
(define serialize-type/list-of-object-setting serialize-type/list-of-string)
(define type/list-of-object-setting? type/list-of-string?)

(define-maybe type/list-of-output-verbosity)
(define serialize-type/list-of-output-verbosity serialize-type/list-of-key-value)
(define type/list-of-output-verbosity? type/list-of-key-value?)



\f
;;;
;;; Actual configuration record.  Contains a lot of generated code.
;;;

;;; Generated code - START.
(define-configuration
  mpv-profile-configuration
  (ab-loop-a maybe-type/time "")
  (ab-loop-b maybe-type/time "")
  (ab-loop-count
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(inf))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 2147483647))))))))
  (access-references maybe-type/boolean "")
  (ad maybe-type/string "")
  (ad-lavc-ac3drc
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 6))))))
  (ad-lavc-downmix maybe-type/boolean "")
  (ad-lavc-o maybe-type/list-of-key-value "")
  (ad-lavc-threads
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 16))))))
  (ad-queue-enable maybe-type/boolean "")
  (ad-queue-max-bytes
   maybe-type/byte-size
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/byte-size? val)
               (>= val 0)
               (<= val 4.6116860184274e18))))))
  (ad-queue-max-samples
   maybe-type/integer64
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer64? val)
               (>= val 0)
               (<= val +inf.0))))))
  (ad-queue-max-secs
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val +inf.0))))))
  (af maybe-type/list-of-object-setting "")
  (audio maybe-type/enumeration
         ""
         (sanitizer
          (lambda (val)
            (or (not (maybe-value-set? val))
                (and (maybe-type/enumeration? val)
                     (or (memq val '(no auto))
                         (and (maybe-type/integer? val)
                              (>= val 0)
                              (<= val 8190))))))))
  (alang maybe-type/list-of-string "")
  (allow-delayed-peak-detect maybe-type/boolean "")
  (alsa-buffer-time
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 2147483647))))))
  (alsa-ignore-chmap maybe-type/boolean "")
  (alsa-mixer-device maybe-type/string "")
  (alsa-mixer-index
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 99))))))
  (alsa-mixer-name maybe-type/string "")
  (alsa-non-interleaved maybe-type/boolean "")
  (alsa-periods
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 2147483647))))))
  (alsa-resample maybe-type/boolean "")
  (ao maybe-type/list-of-object-setting "")
  (ao-null-broken-delay maybe-type/boolean "")
  (ao-null-broken-eof maybe-type/boolean "")
  (ao-null-buffer
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 100))))))
  (ao-null-channel-layouts
   maybe-type/audio-channels-or-channel-map
   "")
  (ao-null-format maybe-type/audio-format "")
  (ao-null-latency
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 100))))))
  (ao-null-outburst
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1)
               (<= val 100000))))))
  (ao-null-speed
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 10000))))))
  (ao-null-untimed maybe-type/boolean "")
  (ao-pcm-append maybe-type/boolean "")
  (ao-pcm-file maybe-type/string "")
  (ao-pcm-waveheader maybe-type/boolean "")
  (audio-backward-batch
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 1024))))))
  (audio-backward-overlap
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(auto))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 1024))))))))
  (audio-buffer
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val 10))))))
  (audio-channels
   maybe-type/audio-channels-or-channel-map
   "")
  (audio-client-name maybe-type/string "")
  (audio-delay maybe-type/float "")
  (audio-demuxer maybe-type/string "")
  (audio-device maybe-type/string "")
  (audio-display
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no embedded-first external-first)))))))
  (audio-exclusive maybe-type/boolean "")
  (audio-exts maybe-type/list-of-string "")
  (audio-fallback-to-null maybe-type/boolean "")
  (audio-file-auto
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no exact fuzzy all)))))))
  (audio-file-paths maybe-type/list-of-string "")
  (audio-files maybe-type/list-of-string "")
  (audio-format maybe-type/audio-format "")
  (audio-normalize-downmix maybe-type/boolean "")
  (audio-pitch-correction maybe-type/boolean "")
  (audio-resample-cutoff
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val 1))))))
  (audio-resample-filter-size
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 32))))))
  (audio-resample-linear maybe-type/boolean "")
  (audio-resample-max-output-size
   maybe-type/double
   "")
  (audio-resample-phase-shift
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 30))))))
  (audio-reversal-buffer
   maybe-type/byte-size
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/byte-size? val)
               (>= val 0)
               (<= val 4.6116860184274e18))))))
  (audio-samplerate
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 768000))))))
  (audio-spdif maybe-type/string "")
  (audio-stream-silence maybe-type/boolean "")
  (audio-swresample-o
   maybe-type/list-of-key-value
   "")
  (audio-wait-open
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 60))))))
  (auto-window-resize maybe-type/boolean "")
  (autocreate-playlist
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no filter same)))))))
  (autofit maybe-type/window-size "")
  (autofit-larger maybe-type/window-size "")
  (autofit-smaller maybe-type/window-size "")
  (autoload-files maybe-type/boolean "")
  (autosync
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(no))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 10000))))))))
  (background
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(none color tiles)))))))
  (background-color maybe-type/color "")
  (blend-subtitles
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no yes video)))))))
  (bluray-device maybe-type/string "")
  (border maybe-type/boolean "")
  (border-background
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(none color tiles)))))))
  (brightness
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -100)
               (<= val 100))))))
  (cache maybe-type/enumeration
         ""
         (sanitizer
          (lambda (val)
            (or (not (maybe-value-set? val))
                (and (maybe-type/enumeration? val)
                     (memq val '(no auto yes)))))))
  (cache-on-disk maybe-type/boolean "")
  (cache-pause maybe-type/boolean "")
  (cache-pause-initial maybe-type/boolean "")
  (cache-pause-wait
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val +inf.0))))))
  (cache-secs
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val +inf.0))))))
  (cdda-cdtext maybe-type/boolean "")
  (cdda-device maybe-type/string "")
  (cdda-overlap
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 75))))))
  (cdda-paranoia
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 2))))))
  (cdda-sector-size
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1)
               (<= val 100))))))
  (cdda-skip maybe-type/boolean "")
  (cdda-span-a maybe-type/integer "")
  (cdda-span-b maybe-type/integer "")
  (cdda-speed
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1)
               (<= val 100))))))
  (cdda-toc-offset maybe-type/integer "")
  (chapter-merge-threshold
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 10000))))))
  (chapter-seek-threshold maybe-type/double "")
  (chapters-file maybe-type/string "")
  (config maybe-type/boolean "")
  (container-fps-override
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val +inf.0))))))
  (contrast
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -100)
               (<= val 100))))))
  (cookies maybe-type/boolean "")
  (cookies-file maybe-type/string "")
  (corner-rounding
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (correct-downscaling maybe-type/boolean "")
  (correct-pts maybe-type/boolean "")
  (cover-art-auto
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no exact fuzzy all)))))))
  (cover-art-files maybe-type/list-of-string "")
  (cover-art-whitelist
   maybe-type/list-of-string
   "")
  (cscale
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(bilinear
                       bicubic_fast
                       oversample
                       spline16
                       spline36
                       spline64
                       sinc
                       lanczos
                       ginseng
                       bicubic
                       hermite
                       catmull_rom
                       mitchell
                       robidoux
                       robidouxsharp
                       box
                       nearest
                       triangle
                       gaussian
                       jinc
                       ewa_lanczos
                       ewa_hanning
                       ewa_ginseng
                       ewa_lanczossharp
                       ewa_lanczos4sharpest
                       ewa_lanczossoft
                       haasnsoft
                       ewa_robidoux
                       ewa_robidouxsharp
                       bartlett
                       cosine
                       hanning
                       tukey
                       hamming
                       quadric
                       welch
                       kaiser
                       blackman
                       sphinx)))))))
  (cscale-antiring
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (cscale-blur maybe-type/float "")
  (cscale-clamp
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (cscale-param1 maybe-type/float "")
  (cscale-param2 maybe-type/float "")
  (cscale-radius
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0.5)
               (<= val 16))))))
  (cscale-taper
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (cscale-window
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(bartlett
                       cosine
                       hanning
                       tukey
                       hamming
                       quadric
                       welch
                       kaiser
                       blackman
                       sphinx
                       jinc)))))))
  (cscale-wparam maybe-type/float "")
  (cscale-wtaper
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (cursor-autohide
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(no always))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 30000))))))))
  (cursor-autohide-fs-only maybe-type/boolean "")
  (deband maybe-type/boolean "")
  (deband-grain
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 4096))))))
  (deband-iterations
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 16))))))
  (deband-range
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 1)
               (<= val 64))))))
  (deband-threshold
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 4096))))))
  (deinterlace
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no yes auto)))))))
  (deinterlace-field-parity
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(tff bff auto)))))))
  (demuxer maybe-type/string "")
  (demuxer-backward-playback-step
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val +inf.0))))))
  (demuxer-cache-dir maybe-type/string "")
  (demuxer-cache-unlink-files
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(immediate whendone no)))))))
  (demuxer-cache-wait maybe-type/boolean "")
  (demuxer-donate-buffer maybe-type/boolean "")
  (demuxer-hysteresis-secs
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val +inf.0))))))
  (demuxer-lavf-allow-mimetype
   maybe-type/boolean
   "")
  (demuxer-lavf-analyzeduration
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 3600))))))
  (demuxer-lavf-buffersize
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1)
               (<= val 10485760))))))
  (demuxer-lavf-format maybe-type/string "")
  (demuxer-lavf-hacks maybe-type/boolean "")
  (demuxer-lavf-linearize-timestamps
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no auto yes)))))))
  (demuxer-lavf-o maybe-type/list-of-key-value "")
  (demuxer-lavf-probe-info
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no yes auto nostreams)))))))
  (demuxer-lavf-probescore
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1)
               (<= val 100))))))
  (demuxer-lavf-probesize
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 32)
               (<= val 2147483647))))))
  (demuxer-lavf-propagate-opts
   maybe-type/boolean
   "")
  (demuxer-max-back-bytes
   maybe-type/byte-size
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/byte-size? val)
               (>= val 0)
               (<= val 4.6116860184274e18))))))
  (demuxer-max-bytes
   maybe-type/byte-size
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/byte-size? val)
               (>= val 0)
               (<= val 4.6116860184274e18))))))
  (demuxer-mkv-probe-start-time
   maybe-type/boolean
   "")
  (demuxer-mkv-probe-video-duration
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no yes full)))))))
  (demuxer-mkv-subtitle-preroll
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no yes index)))))))
  (demuxer-mkv-subtitle-preroll-secs
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val +inf.0))))))
  (demuxer-mkv-subtitle-preroll-secs-index
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val +inf.0))))))
  (demuxer-rawaudio-channels
   maybe-type/audio-channels-or-channel-map
   "")
  (demuxer-rawaudio-format
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(u8 s8
                          u16le
                          u16be
                          s16le
                          s16be
                          u24le
                          u24be
                          s24le
                          s24be
                          u32le
                          u32be
                          s32le
                          s32be
                          floatle
                          floatbe
                          doublele
                          doublebe
                          u16
                          s16
                          u24
                          s24
                          u32
                          s32
                          float
                          double)))))))
  (demuxer-rawaudio-rate
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1000)
               (<= val 384000))))))
  (demuxer-rawvideo-codec maybe-type/string "")
  (demuxer-rawvideo-format maybe-type/fourcc "")
  (demuxer-rawvideo-fps
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0.001)
               (<= val 1000))))))
  (demuxer-rawvideo-h
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1)
               (<= val 8192))))))
  (demuxer-rawvideo-mp-format
   maybe-type/image-format
   "")
  (demuxer-rawvideo-size
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1)
               (<= val 268435456))))))
  (demuxer-rawvideo-w
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1)
               (<= val 8192))))))
  (demuxer-readahead-secs
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val +inf.0))))))
  (demuxer-seekable-cache
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto no yes)))))))
  (demuxer-termination-timeout
   maybe-type/double
   "")
  (demuxer-thread maybe-type/boolean "")
  (directory-filter-types
   maybe-type/list-of-string
   "")
  (directory-mode
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto lazy recursive ignore)))))))
  (display-fps-override
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val +inf.0))))))
  (display-tags maybe-type/list-of-string "")
  (dither
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(fruit ordered error-diffusion no)))))))
  (dither-depth
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(no auto))
                   (and (maybe-type/integer? val)
                        (>= val -1)
                        (<= val 16))))))))
  (dither-size-fruit
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 2)
               (<= val 8))))))
  (drag-and-drop
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no auto replace append insert-next)))))))
  (drm-connector maybe-type/string "")
  (drm-device maybe-type/string "")
  (drm-draw-plane
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(primary overlay))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 2147483647))))))))
  (drm-draw-surface-size maybe-type/window-size "")
  (drm-drmprime-video-plane
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(primary overlay))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 2147483647))))))))
  (drm-format
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(xrgb8888 xrgb2101010 xbgr8888 xbgr2101010 yuyv)))))))
  (drm-mode maybe-type/string "")
  (drm-vrr-enabled
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no yes auto)))))))
  (dscale
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(bilinear
                       bicubic_fast
                       oversample
                       spline16
                       spline36
                       spline64
                       sinc
                       lanczos
                       ginseng
                       bicubic
                       hermite
                       catmull_rom
                       mitchell
                       robidoux
                       robidouxsharp
                       box
                       nearest
                       triangle
                       gaussian
                       jinc
                       ewa_lanczos
                       ewa_hanning
                       ewa_ginseng
                       ewa_lanczossharp
                       ewa_lanczos4sharpest
                       ewa_lanczossoft
                       haasnsoft
                       ewa_robidoux
                       ewa_robidouxsharp
                       bartlett
                       cosine
                       hanning
                       tukey
                       hamming
                       quadric
                       welch
                       kaiser
                       blackman
                       sphinx)))))))
  (dscale-antiring
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (dscale-blur maybe-type/float "")
  (dscale-clamp
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (dscale-param1 maybe-type/float "")
  (dscale-param2 maybe-type/float "")
  (dscale-radius
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0.5)
               (<= val 16))))))
  (dscale-taper
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (dscale-window
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(bartlett
                       cosine
                       hanning
                       tukey
                       hamming
                       quadric
                       welch
                       kaiser
                       blackman
                       sphinx
                       jinc)))))))
  (dscale-wparam maybe-type/float "")
  (dscale-wtaper
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (dump-stats maybe-type/string "")
  (dvbin-card
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 15))))))
  (dvbin-channel-switch-offset
   maybe-type/integer
   "")
  (dvbin-file maybe-type/string "")
  (dvbin-full-transponder maybe-type/boolean "")
  (dvbin-prog maybe-type/string "")
  (dvbin-timeout
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1)
               (<= val 30))))))
  (dvd-angle
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1)
               (<= val 99))))))
  (dvd-device maybe-type/string "")
  (dvd-speed maybe-type/integer "")
  (edition
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(auto))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 8190))))))))
  (egl-config-id maybe-type/integer "")
  (egl-output-format
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(auto rgb8
                            rgba8
                            rgb10
                            rgb10_a2
                            rgb16
                            rgba16
                            rgb16f
                            rgba16f
                            rgb32f
                            rgba32f)))))))
  (embeddedfonts maybe-type/boolean "")
  (end maybe-type/relative-time-or-percent-position
       "")
  (error-diffusion maybe-type/string "")
  (external-files maybe-type/list-of-string "")
  (fbo-format maybe-type/string "")
  (focus-on
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(never open all)))))))
  (force-media-title maybe-type/string "")
  (force-render maybe-type/boolean "")
  (force-rgba-osd-rendering maybe-type/boolean "")
  (force-seekable maybe-type/boolean "")
  (force-window
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no yes immediate)))))))
  (force-window-position maybe-type/boolean "")
  (framedrop
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no vo decoder decoder+vo)))))))
  (frames
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(all))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 2147483647))))))))
  (fs-screen
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(all current))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 32))))))))
  (fs-screen-name maybe-type/string "")
  (fullscreen maybe-type/boolean "")
  (gamma maybe-type/float
         ""
         (sanitizer
          (lambda (val)
            (or (not (maybe-value-set? val))
                (and (maybe-type/float? val)
                     (>= val -100)
                     (<= val 100))))))
  (gamma-auto maybe-type/boolean "")
  (gamma-factor
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0.1)
               (<= val 2))))))
  (gamut-mapping-mode
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(auto clip
                            perceptual
                            relative
                            saturation
                            absolute
                            desaturate
                            darken
                            warn
                            linear)))))))
  (gapless-audio
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no yes weak)))))))
  (geometry maybe-type/window-geometry "")
  (glsl-shader-opts
   maybe-type/list-of-key-value
   "")
  (glsl-shaders maybe-type/list-of-string "")
  (gpu-api maybe-type/list-of-object-setting "")
  (gpu-context
   maybe-type/list-of-object-setting
   "")
  (gpu-debug maybe-type/boolean "")
  (gpu-dumb-mode
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto yes no)))))))
  (gpu-hwdec-interop maybe-type/string "")
  (gpu-shader-cache maybe-type/boolean "")
  (gpu-shader-cache-dir maybe-type/string "")
  (gpu-sw maybe-type/boolean "")
  (gpu-tex-pad-x
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 4096))))))
  (gpu-tex-pad-y
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 4096))))))
  (hdr-compute-peak
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto yes no)))))))
  (hdr-contrast-recovery
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 2))))))
  (hdr-contrast-smoothness
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 1)
               (<= val 100))))))
  (hdr-peak-decay-rate
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1000))))))
  (hdr-peak-percentile
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 100))))))
  (hdr-scene-threshold-high
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 20))))))
  (hdr-scene-threshold-low
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 20))))))
  (hidpi-window-scale maybe-type/boolean "")
  (hls-bitrate
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(no min max))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 2147483647))))))))
  (hr-seek
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no absolute yes always default)))))))
  (hr-seek-demuxer-offset maybe-type/float "")
  (hr-seek-framedrop maybe-type/boolean "")
  (http-header-fields maybe-type/list-of-string "")
  (http-proxy maybe-type/string "")
  (hue maybe-type/float
       ""
       (sanitizer
        (lambda (val)
          (or (not (maybe-value-set? val))
              (and (maybe-type/float? val)
                   (>= val -100)
                   (<= val 100))))))
  (hwdec maybe-type/list-of-string "")
  (hwdec-codecs maybe-type/string "")
  (hwdec-extra-frames
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 256))))))
  (hwdec-image-format maybe-type/image-format "")
  (icc-3dlut-size maybe-type/string "")
  (icc-cache maybe-type/boolean "")
  (icc-cache-dir maybe-type/string "")
  (icc-force-contrast
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(no inf))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 1000000))))))))
  (icc-intent maybe-type/integer "")
  (icc-profile maybe-type/string "")
  (icc-profile-auto maybe-type/boolean "")
  (icc-use-luma maybe-type/boolean "")
  (idle maybe-type/enumeration
        ""
        (sanitizer
         (lambda (val)
           (or (not (maybe-value-set? val))
               (and (maybe-type/enumeration? val)
                    (memq val '(no once yes)))))))
  (ignore-path-in-watch-later-config
   maybe-type/boolean
   "")
  (image-display-duration
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val +inf.0))))))
  (image-exts maybe-type/list-of-string "")
  (image-lut maybe-type/string "")
  (image-lut-type
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto native normalized conversion)))))))
  (image-subs-video-resolution
   maybe-type/boolean
   "")
  (include maybe-type/string "")
  (index maybe-type/enumeration
         ""
         (sanitizer
          (lambda (val)
            (or (not (maybe-value-set? val))
                (and (maybe-type/enumeration? val)
                     (memq val '(default recreate)))))))
  (initial-audio-sync maybe-type/boolean "")
  (input-ar-delay maybe-type/integer "")
  (input-ar-rate maybe-type/integer "")
  (input-builtin-bindings maybe-type/boolean "")
  (input-builtin-dragging maybe-type/boolean "")
  (input-commands maybe-type/list-of-string "")
  (input-conf maybe-type/string "")
  (input-cursor maybe-type/boolean "")
  (input-cursor-passthrough maybe-type/boolean "")
  (input-default-bindings maybe-type/boolean "")
  (input-doubleclick-time
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 1000))))))
  (input-dragging-deadzone maybe-type/integer "")
  (input-ipc-client maybe-type/string "")
  (input-ipc-server maybe-type/string "")
  (input-key-fifo-size
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 2)
               (<= val 65000))))))
  (input-media-keys maybe-type/boolean "")
  (input-preprocess-wheel maybe-type/boolean "")
  (input-right-alt-gr maybe-type/boolean "")
  (input-terminal maybe-type/boolean "")
  (input-test maybe-type/boolean "")
  (input-touch-emulate-mouse maybe-type/boolean "")
  (input-vo-keyboard maybe-type/boolean "")
  (interpolation maybe-type/boolean "")
  (interpolation-preserve maybe-type/boolean "")
  (interpolation-threshold maybe-type/float "")
  (inverse-tone-mapping maybe-type/boolean "")
  (jack-autostart maybe-type/boolean "")
  (jack-connect maybe-type/boolean "")
  (jack-name maybe-type/string "")
  (jack-port maybe-type/string "")
  (jack-std-channel-layout
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(waveext any)))))))
  (keep-open
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no yes always)))))))
  (keep-open-pause maybe-type/boolean "")
  (keepaspect maybe-type/boolean "")
  (keepaspect-window maybe-type/boolean "")
  (lavfi-complex maybe-type/string "")
  (length
   maybe-type/relative-time-or-percent-position
   "")
  (libplacebo-opts maybe-type/list-of-key-value "")
  (linear-downscaling maybe-type/boolean "")
  (linear-upscaling maybe-type/boolean "")
  (load-auto-profiles
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no yes auto)))))))
  (load-osd-console maybe-type/boolean "")
  (load-scripts maybe-type/boolean "")
  (load-select maybe-type/boolean "")
  (load-stats-overlay maybe-type/boolean "")
  (load-unsafe-playlists maybe-type/boolean "")
  (log-file maybe-type/string "")
  (loop-file
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(no inf yes))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 10000))))))))
  (loop-playlist
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(no inf yes force))
                   (and (maybe-type/integer? val)
                        (>= val 1)
                        (<= val 10000))))))))
  (lut maybe-type/string "")
  (lut-type
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto native normalized conversion)))))))
  (mc maybe-type/float
      ""
      (sanitizer
       (lambda (val)
         (or (not (maybe-value-set? val))
             (and (maybe-type/float? val)
                  (>= val 0)
                  (<= val 100))))))
  (media-controls
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no player yes)))))))
  (merge-files maybe-type/boolean "")
  (metadata-codepage maybe-type/string "")
  (mf-fps maybe-type/double "")
  (mf-type maybe-type/string "")
  (monitoraspect
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 9))))))
  (monitorpixelaspect
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0.03125)
               (<= val 32))))))
  (msg-color maybe-type/boolean "")
  (msg-level
   maybe-type/list-of-output-verbosity
   "")
  (msg-module maybe-type/boolean "")
  (msg-time maybe-type/boolean "")
  (mute maybe-type/boolean "")
  (native-fs maybe-type/boolean "")
  (native-keyrepeat maybe-type/boolean "")
  (native-touch maybe-type/boolean "")
  (network-timeout
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val +inf.0))))))
  (oac maybe-type/string "")
  (oacopts maybe-type/list-of-key-value "")
  (ocopy-metadata maybe-type/boolean "")
  (of maybe-type/string "")
  (ofopts maybe-type/list-of-key-value "")
  (on-all-workspaces maybe-type/boolean "")
  (ontop maybe-type/boolean "")
  (ontop-level
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(window system desktop))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 2147483647))))))))
  (opengl-check-pattern-a maybe-type/integer "")
  (opengl-check-pattern-b maybe-type/integer "")
  (opengl-early-flush
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no yes auto)))))))
  (opengl-es
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto yes no)))))))
  (opengl-glfinish maybe-type/boolean "")
  (opengl-pbo maybe-type/boolean "")
  (opengl-rectangle-textures maybe-type/boolean "")
  (opengl-swapinterval maybe-type/integer "")
  (opengl-waitvsync maybe-type/boolean "")
  (orawts maybe-type/boolean "")
  (ordered-chapters maybe-type/boolean "")
  (ordered-chapters-files maybe-type/string "")
  (oremove-metadata maybe-type/list-of-string "")
  (osc maybe-type/boolean "")
  (osd-align-x
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(left center right)))))))
  (osd-align-y
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(top center bottom)))))))
  (osd-back-color maybe-type/color "")
  (osd-bar maybe-type/boolean "")
  (osd-bar-align-x
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -1)
               (<= val 1))))))
  (osd-bar-align-y
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -1)
               (<= val 1))))))
  (osd-bar-h
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0.1)
               (<= val 50))))))
  (osd-bar-outline-size
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1000))))))
  (osd-bar-w
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 1)
               (<= val 100))))))
  (osd-blur
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 20))))))
  (osd-bold maybe-type/boolean "")
  (osd-border-style
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(outline-and-shadow opaque-box background-box)))))))
  (osd-color maybe-type/color "")
  (osd-duration
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 3600000))))))
  (osd-font maybe-type/string "")
  (osd-font-provider
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto none fontconfig)))))))
  (osd-font-size
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 1)
               (<= val 9000))))))
  (osd-fonts-dir maybe-type/string "")
  (osd-fractions maybe-type/boolean "")
  (osd-italic maybe-type/boolean "")
  (osd-justify
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto left center right)))))))
  (osd-level
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(#{0}# #{1}# #{2}# #{3}#)))))))
  (osd-margin-x
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 300))))))
  (osd-margin-y
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 600))))))
  (osd-msg1 maybe-type/string "")
  (osd-msg2 maybe-type/string "")
  (osd-msg3 maybe-type/string "")
  (osd-on-seek
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no bar msg msg-bar)))))))
  (osd-outline-color maybe-type/color "")
  (osd-outline-size maybe-type/float "")
  (osd-playing-msg maybe-type/string "")
  (osd-playing-msg-duration
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 3600000))))))
  (osd-playlist-entry
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(title filename both)))))))
  (osd-scale
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 100))))))
  (osd-scale-by-window maybe-type/boolean "")
  (osd-shadow-offset maybe-type/float "")
  (osd-spacing
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -10)
               (<= val 10))))))
  (osd-status-msg maybe-type/string "")
  (oset-metadata maybe-type/list-of-key-value "")
  (ovc maybe-type/string "")
  (ovcopts maybe-type/list-of-key-value "")
  (panscan
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (pause maybe-type/boolean "")
  (pitch maybe-type/double
         ""
         (sanitizer
          (lambda (val)
            (or (not (maybe-value-set? val))
                (and (maybe-type/double? val)
                     (>= val 0.01)
                     (<= val 100))))))
  (play-direction
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(forward + backward -)))))))
  (player-operation-mode
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(cplayer pseudo-gui)))))))
  (playlist-start
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(auto no))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 2147483647))))))))
  (prefetch-playlist maybe-type/boolean "")
  (profile maybe-type/list-of-string "")
  (pulse-allow-suspended maybe-type/boolean "")
  (pulse-buffer
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(native))
                   (and (maybe-type/integer? val)
                        (>= val 1)
                        (<= val 2000))))))))
  (pulse-host maybe-type/string "")
  (pulse-latency-hacks maybe-type/boolean "")
  (quiet maybe-type/boolean "")
  (really-quiet maybe-type/boolean "")
  (rebase-start-time maybe-type/boolean "")
  (referrer maybe-type/string "")
  (replaygain
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no track album)))))))
  (replaygain-clip maybe-type/boolean "")
  (replaygain-fallback
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -200)
               (<= val 60))))))
  (replaygain-preamp
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -150)
               (<= val 150))))))
  (reset-on-next-file maybe-type/list-of-string "")
  (resume-playback maybe-type/boolean "")
  (resume-playback-check-mtime
   maybe-type/boolean
   "")
  (rtsp-transport
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(lavf udp tcp http udp_multicast)))))))
  (saturation
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -100)
               (<= val 100))))))
  (save-position-on-quit maybe-type/boolean "")
  (scale maybe-type/enumeration
         ""
         (sanitizer
          (lambda (val)
            (or (not (maybe-value-set? val))
                (and (maybe-type/enumeration? val)
                     (memq val
                           '(bilinear
                             bicubic_fast
                             oversample
                             spline16
                             spline36
                             spline64
                             sinc
                             lanczos
                             ginseng
                             bicubic
                             hermite
                             catmull_rom
                             mitchell
                             robidoux
                             robidouxsharp
                             box
                             nearest
                             triangle
                             gaussian
                             jinc
                             ewa_lanczos
                             ewa_hanning
                             ewa_ginseng
                             ewa_lanczossharp
                             ewa_lanczos4sharpest
                             ewa_lanczossoft
                             haasnsoft
                             ewa_robidoux
                             ewa_robidouxsharp
                             bartlett
                             cosine
                             hanning
                             tukey
                             hamming
                             quadric
                             welch
                             kaiser
                             blackman
                             sphinx)))))))
  (scale-antiring
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (scale-blur maybe-type/float "")
  (scale-clamp
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (scale-param1 maybe-type/float "")
  (scale-param2 maybe-type/float "")
  (scale-radius
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0.5)
               (<= val 16))))))
  (scale-taper
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (scale-window
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(bartlett
                       cosine
                       hanning
                       tukey
                       hamming
                       quadric
                       welch
                       kaiser
                       blackman
                       sphinx
                       jinc)))))))
  (scale-wparam maybe-type/float "")
  (scale-wtaper
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (scaler-resizes-only maybe-type/boolean "")
  (screen
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(default))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 32))))))))
  (screen-name maybe-type/string "")
  (screenshot-avif-encoder maybe-type/string "")
  (screenshot-avif-opts
   maybe-type/list-of-key-value
   "")
  (screenshot-avif-pixfmt maybe-type/string "")
  (screenshot-directory maybe-type/string "")
  (screenshot-format
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(jpg jpeg png webp jxl avif)))))))
  (screenshot-high-bit-depth maybe-type/boolean "")
  (screenshot-jpeg-quality
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 100))))))
  (screenshot-jpeg-source-chroma
   maybe-type/boolean
   "")
  (screenshot-jxl-distance
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val 15))))))
  (screenshot-jxl-effort
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1)
               (<= val 9))))))
  (screenshot-png-compression
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 9))))))
  (screenshot-png-filter
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 5))))))
  (screenshot-sw maybe-type/boolean "")
  (screenshot-tag-colorspace maybe-type/boolean "")
  (screenshot-template maybe-type/string "")
  (screenshot-webp-compression
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 6))))))
  (screenshot-webp-lossless maybe-type/boolean "")
  (screenshot-webp-quality
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 100))))))
  (script-opts maybe-type/list-of-key-value "")
  (scripts maybe-type/list-of-string "")
  (secondary-sid
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(no auto))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 8190))))))))
  (secondary-sub-ass-override
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no yes scale force strip)))))))
  (secondary-sub-delay maybe-type/float "")
  (secondary-sub-pos
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 150))))))
  (secondary-sub-visibility maybe-type/boolean "")
  (sharpen maybe-type/float "")
  (show-in-taskbar maybe-type/boolean "")
  (shuffle maybe-type/boolean "")
  (sub maybe-type/enumeration
       ""
       (sanitizer
        (lambda (val)
          (or (not (maybe-value-set? val))
              (and (maybe-type/enumeration? val)
                   (or (memq val '(no auto))
                       (and (maybe-type/integer? val)
                            (>= val 0)
                            (<= val 8190))))))))
  (sigmoid-center
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (sigmoid-slope
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 1)
               (<= val 20))))))
  (sigmoid-upscaling maybe-type/boolean "")
  (slang maybe-type/list-of-string "")
  (snap-window maybe-type/boolean "")
  (speed maybe-type/double
         ""
         (sanitizer
          (lambda (val)
            (or (not (maybe-value-set? val))
                (and (maybe-type/double? val)
                     (>= val 0.01)
                     (<= val 100))))))
  (spirv-compiler
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto)))))))
  (sstep maybe-type/double
         ""
         (sanitizer
          (lambda (val)
            (or (not (maybe-value-set? val))
                (and (maybe-type/double? val)
                     (>= val 0)
                     (<= val +inf.0))))))
  (start maybe-type/relative-time-or-percent-position
         "")
  (stop-playback-on-init-failure
   maybe-type/boolean
   "")
  (stop-screensaver
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no yes always)))))))
  (stream-buffer-size
   maybe-type/byte-size
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/byte-size? val)
               (>= val 4096)
               (<= val 536870912))))))
  (stream-dump maybe-type/string "")
  (stream-lavf-o maybe-type/list-of-key-value "")
  (stream-record maybe-type/string "")
  (stretch-dvd-subs maybe-type/boolean "")
  (stretch-image-subs-to-screen
   maybe-type/boolean
   "")
  (sub-align-x
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(left center right)))))))
  (sub-align-y
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(top center bottom)))))))
  (sub-ass maybe-type/boolean "")
  (sub-ass-force-margins maybe-type/boolean "")
  (sub-ass-hinting
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(none light normal native)))))))
  (sub-ass-justify maybe-type/boolean "")
  (sub-ass-line-spacing
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -1000)
               (<= val 1000))))))
  (sub-ass-override
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no yes scale force strip)))))))
  (sub-ass-scale-with-window maybe-type/boolean "")
  (sub-ass-shaper
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(simple complex)))))))
  (sub-ass-style-overrides
   maybe-type/list-of-string
   "")
  (sub-ass-styles maybe-type/string "")
  (sub-ass-use-video-data
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(none aspect-ratio all)))))))
  (sub-ass-video-aspect-override
   maybe-type/aspect
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/aspect? val)
               (>= val 0)
               (<= val 10))))))
  (sub-ass-vsfilter-color-compat
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no basic full force-601)))))))
  (sub-auto
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no exact fuzzy all)))))))
  (sub-auto-exts maybe-type/list-of-string "")
  (sub-back-color maybe-type/color "")
  (sub-blur
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 20))))))
  (sub-bold maybe-type/boolean "")
  (sub-border-style
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(outline-and-shadow opaque-box background-box)))))))
  (sub-clear-on-seek maybe-type/boolean "")
  (sub-codepage maybe-type/string "")
  (sub-color maybe-type/color "")
  (sub-create-cc-track maybe-type/boolean "")
  (sub-delay maybe-type/float "")
  (sub-demuxer maybe-type/string "")
  (sub-file-paths maybe-type/list-of-string "")
  (sub-files maybe-type/list-of-string "")
  (sub-filter-jsre maybe-type/list-of-string "")
  (sub-filter-regex maybe-type/list-of-string "")
  (sub-filter-regex-enable maybe-type/boolean "")
  (sub-filter-regex-plain maybe-type/boolean "")
  (sub-filter-regex-warn maybe-type/boolean "")
  (sub-filter-sdh maybe-type/boolean "")
  (sub-filter-sdh-enclosures maybe-type/string "")
  (sub-filter-sdh-harder maybe-type/boolean "")
  (sub-fix-timing maybe-type/boolean "")
  (sub-font maybe-type/string "")
  (sub-font-provider
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto none fontconfig)))))))
  (sub-font-size
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 1)
               (<= val 9000))))))
  (sub-fonts-dir maybe-type/string "")
  (sub-forced-events-only maybe-type/boolean "")
  (sub-fps maybe-type/float "")
  (sub-gauss
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 3))))))
  (sub-gray maybe-type/boolean "")
  (sub-italic maybe-type/boolean "")
  (sub-justify
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto left center right)))))))
  (sub-lavc-o maybe-type/list-of-key-value "")
  (sub-margin-x
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 300))))))
  (sub-margin-y
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 600))))))
  (sub-outline-color maybe-type/color "")
  (sub-outline-size maybe-type/float "")
  (sub-past-video-end maybe-type/boolean "")
  (sub-pos
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 150))))))
  (sub-scale
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 100))))))
  (sub-scale-by-window maybe-type/boolean "")
  (sub-scale-with-window maybe-type/boolean "")
  (sub-shadow-offset maybe-type/float "")
  (sub-spacing
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -10)
               (<= val 10))))))
  (sub-speed maybe-type/float "")
  (sub-stretch-durations maybe-type/boolean "")
  (sub-use-margins maybe-type/boolean "")
  (sub-visibility maybe-type/boolean "")
  (sub-vsfilter-bidi-compat maybe-type/boolean "")
  (subs-fallback
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no default yes)))))))
  (subs-fallback-forced
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no yes always)))))))
  (subs-match-os-language maybe-type/boolean "")
  (subs-with-matching-audio
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no forced yes)))))))
  (swapchain-depth
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1)
               (<= val 8))))))
  (sws-allow-zimg maybe-type/boolean "")
  (sws-bitexact maybe-type/boolean "")
  (sws-cgb
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 100))))))
  (sws-chs maybe-type/integer "")
  (sws-cs
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -100)
               (<= val 100))))))
  (sws-cvs maybe-type/integer "")
  (sws-fast maybe-type/boolean "")
  (sws-lgb
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 100))))))
  (sws-ls
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -100)
               (<= val 100))))))
  (sws-scaler
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(fast-bilinear
                       bilinear
                       bicubic
                       x
                       point
                       area
                       bicublin
                       gauss
                       sinc
                       lanczos
                       spline)))))))
  (target-colorspace-hint maybe-type/boolean "")
  (target-contrast
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(auto inf))
                   (and (maybe-type/integer? val)
                        (>= val 10)
                        (<= val 1000000))))))))
  (target-gamut
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(auto bt.601-525
                            bt.601-625
                            bt.709
                            bt.2020
                            bt.470m
                            apple
                            adobe
                            prophoto
                            cie1931
                            dci-p3
                            display-p3
                            v-gamut
                            s-gamut
                            ebu3213
                            film-c
                            aces-ap0
                            aces-ap1)))))))
  (target-lut maybe-type/string "")
  (target-peak
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(auto))
                   (and (maybe-type/integer? val)
                        (>= val 10)
                        (<= val 10000))))))))
  (target-prim
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(auto bt.601-525
                            bt.601-625
                            bt.709
                            bt.2020
                            bt.470m
                            apple
                            adobe
                            prophoto
                            cie1931
                            dci-p3
                            display-p3
                            v-gamut
                            s-gamut
                            ebu3213
                            film-c
                            aces-ap0
                            aces-ap1)))))))
  (target-trc
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(auto bt.1886
                            srgb
                            linear
                            gamma1.8
                            gamma2.0
                            gamma2.2
                            gamma2.4
                            gamma2.6
                            gamma2.8
                            prophoto
                            pq
                            hlg
                            v-log
                            s-log1
                            s-log2
                            st428)))))))
  (taskbar-progress maybe-type/boolean "")
  (teletext-page
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val -1)
               (<= val 999))))))
  (temporal-dither maybe-type/boolean "")
  (temporal-dither-period
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1)
               (<= val 128))))))
  (term-osd
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(force auto no)))))))
  (term-osd-bar maybe-type/boolean "")
  (term-osd-bar-chars maybe-type/string "")
  (term-playing-msg maybe-type/string "")
  (term-status-msg maybe-type/string "")
  (term-title maybe-type/string "")
  (terminal maybe-type/boolean "")
  (title maybe-type/string "")
  (title-bar maybe-type/boolean "")
  (tls-ca-file maybe-type/string "")
  (tls-cert-file maybe-type/string "")
  (tls-key-file maybe-type/string "")
  (tls-verify maybe-type/boolean "")
  (tone-mapping
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(auto clip
                            mobius
                            reinhard
                            hable
                            gamma
                            linear
                            spline
                            bt.2390
                            bt.2446a
                            st2094-40
                            st2094-10)))))))
  (tone-mapping-max-boost
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 1)
               (<= val 10))))))
  (tone-mapping-param maybe-type/float "")
  (tone-mapping-visualize maybe-type/boolean "")
  (track-auto-selection maybe-type/boolean "")
  (tscale
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(oversample
                       linear
                       spline16
                       spline36
                       spline64
                       sinc
                       lanczos
                       ginseng
                       bicubic
                       hermite
                       catmull_rom
                       mitchell
                       robidoux
                       robidouxsharp
                       box
                       nearest
                       triangle
                       gaussian
                       bartlett
                       cosine
                       hanning
                       tukey
                       hamming
                       quadric
                       welch
                       kaiser
                       blackman
                       sphinx
                       jinc)))))))
  (tscale-antiring
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (tscale-blur maybe-type/float "")
  (tscale-clamp
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (tscale-param1 maybe-type/float "")
  (tscale-param2 maybe-type/float "")
  (tscale-radius
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0.5)
               (<= val 16))))))
  (tscale-taper
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (tscale-window
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(bartlett
                       cosine
                       hanning
                       tukey
                       hamming
                       quadric
                       welch
                       kaiser
                       blackman
                       sphinx
                       jinc)))))))
  (tscale-wparam maybe-type/float "")
  (tscale-wtaper
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (untimed maybe-type/boolean "")
  (use-embedded-icc-profile maybe-type/boolean "")
  (use-filedir-conf maybe-type/boolean "")
  (user-agent maybe-type/string "")
  (vaapi-device maybe-type/string "")
  (vd maybe-type/string "")
  (vd-apply-cropping maybe-type/boolean "")
  (vd-lavc-assume-old-x264 maybe-type/boolean "")
  (vd-lavc-bitexact maybe-type/boolean "")
  (vd-lavc-check-hw-profile maybe-type/boolean "")
  (vd-lavc-dr
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto no yes)))))))
  (vd-lavc-fast maybe-type/boolean "")
  (vd-lavc-film-grain
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto cpu gpu)))))))
  (vd-lavc-framedrop
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(none default nonref bidir nonkey all)))))))
  (vd-lavc-o maybe-type/list-of-key-value "")
  (vd-lavc-show-all maybe-type/boolean "")
  (vd-lavc-skipframe
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(none default nonref bidir nonkey all)))))))
  (vd-lavc-skipidct
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(none default nonref bidir nonkey all)))))))
  (vd-lavc-skiploopfilter
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(none default nonref bidir nonkey all)))))))
  (vd-lavc-software-fallback
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(no yes))
                   (and (maybe-type/integer? val)
                        (>= val 1)
                        (<= val 2147483647))))))))
  (vd-lavc-threads
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val +inf.0))))))
  (vd-queue-enable maybe-type/boolean "")
  (vd-queue-max-bytes
   maybe-type/byte-size
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/byte-size? val)
               (>= val 0)
               (<= val 4.6116860184274e18))))))
  (vd-queue-max-samples
   maybe-type/integer64
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer64? val)
               (>= val 0)
               (<= val +inf.0))))))
  (vd-queue-max-secs
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val +inf.0))))))
  (vf maybe-type/list-of-object-setting "")
  (video maybe-type/enumeration
         ""
         (sanitizer
          (lambda (val)
            (or (not (maybe-value-set? val))
                (and (maybe-type/enumeration? val)
                     (or (memq val '(no auto))
                         (and (maybe-type/integer? val)
                              (>= val 0)
                              (<= val 8190))))))))
  (video-align-x
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -1)
               (<= val 1))))))
  (video-align-y
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -1)
               (<= val 1))))))
  (video-aspect-method
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(bitstream container)))))))
  (video-aspect-override
   maybe-type/aspect
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/aspect? val)
               (>= val -1)
               (<= val 10))))))
  (video-backward-batch
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 1024))))))
  (video-backward-overlap
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(auto))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 1024))))))))
  (video-crop maybe-type/video-rectangle "")
  (video-exts maybe-type/list-of-string "")
  (video-latency-hacks maybe-type/boolean "")
  (video-margin-ratio-bottom
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (video-margin-ratio-left
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (video-margin-ratio-right
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (video-margin-ratio-top
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (video-osd maybe-type/boolean "")
  (video-output-levels
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto limited full)))))))
  (video-pan-x maybe-type/float "")
  (video-pan-y maybe-type/float "")
  (video-reversal-buffer
   maybe-type/byte-size
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/byte-size? val)
               (>= val 0)
               (<= val 4.6116860184274e18))))))
  (video-rotate
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(no))
                   (and (maybe-type/integer? val)
                        (>= val 0)
                        (<= val 359))))))))
  (video-scale-x
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 10000))))))
  (video-scale-y
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 10000))))))
  (video-sync
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(audio display-resample
                             display-resample-vdrop
                             display-resample-desync
                             display-tempo
                             display-adrop
                             display-vdrop
                             display-desync
                             desync)))))))
  (video-sync-max-audio-change
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val 1))))))
  (video-sync-max-factor
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1)
               (<= val 10))))))
  (video-sync-max-video-change
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val +inf.0))))))
  (video-timing-offset
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val 1))))))
  (video-unscaled
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no yes downscale-big)))))))
  (video-zoom
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -20)
               (<= val 20))))))
  (vlang maybe-type/list-of-string "")
  (vo maybe-type/list-of-object-setting "")
  (vo-image-avif-encoder maybe-type/string "")
  (vo-image-avif-opts
   maybe-type/list-of-key-value
   "")
  (vo-image-avif-pixfmt maybe-type/string "")
  (vo-image-format
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(jpg jpeg png webp jxl avif)))))))
  (vo-image-high-bit-depth maybe-type/boolean "")
  (vo-image-jpeg-quality
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 100))))))
  (vo-image-jpeg-source-chroma
   maybe-type/boolean
   "")
  (vo-image-jxl-distance
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val 15))))))
  (vo-image-jxl-effort
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1)
               (<= val 9))))))
  (vo-image-outdir maybe-type/string "")
  (vo-image-png-compression
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 9))))))
  (vo-image-png-filter
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 5))))))
  (vo-image-tag-colorspace maybe-type/boolean "")
  (vo-image-webp-compression
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 6))))))
  (vo-image-webp-lossless maybe-type/boolean "")
  (vo-image-webp-quality
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 100))))))
  (vo-kitty-alt-screen maybe-type/boolean "")
  (vo-kitty-cols maybe-type/integer "")
  (vo-kitty-config-clear maybe-type/boolean "")
  (vo-kitty-height maybe-type/integer "")
  (vo-kitty-left maybe-type/integer "")
  (vo-kitty-rows maybe-type/integer "")
  (vo-kitty-top maybe-type/integer "")
  (vo-kitty-use-shm maybe-type/boolean "")
  (vo-kitty-width maybe-type/integer "")
  (vo-null-fps
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0)
               (<= val 10000))))))
  (vo-sixel-alt-screen maybe-type/boolean "")
  (vo-sixel-buffered maybe-type/boolean "")
  (vo-sixel-cols maybe-type/integer "")
  (vo-sixel-config-clear maybe-type/boolean "")
  (vo-sixel-dither
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(auto none
                            atkinson
                            fs
                            jajuni
                            stucki
                            burkes
                            arithmetic
                            xor)))))))
  (vo-sixel-fixedpalette maybe-type/boolean "")
  (vo-sixel-height maybe-type/integer "")
  (vo-sixel-left maybe-type/integer "")
  (vo-sixel-pad-x maybe-type/integer "")
  (vo-sixel-pad-y maybe-type/integer "")
  (vo-sixel-reqcolors maybe-type/integer "")
  (vo-sixel-rows maybe-type/integer "")
  (vo-sixel-threshold maybe-type/integer "")
  (vo-sixel-top maybe-type/integer "")
  (vo-sixel-width maybe-type/integer "")
  (vo-tct-256 maybe-type/boolean "")
  (vo-tct-algo
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(plain half-blocks)))))))
  (vo-tct-buffering
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(pixel line frame)))))))
  (vo-tct-height maybe-type/integer "")
  (vo-tct-width maybe-type/integer "")
  (vo-vaapi-scaled-osd maybe-type/boolean "")
  (vo-vaapi-scaling
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(default fast hq nla)))))))
  (vo-vdpau-chroma-deint maybe-type/boolean "")
  (vo-vdpau-colorkey maybe-type/color "")
  (vo-vdpau-composite-detect maybe-type/boolean "")
  (vo-vdpau-denoise
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 1))))))
  (vo-vdpau-force-yuv maybe-type/boolean "")
  (vo-vdpau-fps maybe-type/double "")
  (vo-vdpau-hqscaling
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 9))))))
  (vo-vdpau-output-surfaces
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 2)
               (<= val 15))))))
  (vo-vdpau-pullup maybe-type/boolean "")
  (vo-vdpau-queuetime-fs maybe-type/integer "")
  (vo-vdpau-queuetime-windowed
   maybe-type/integer
   "")
  (vo-vdpau-sharpen
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -1)
               (<= val 1))))))
  (volume
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -1)
               (<= val 1000))))))
  (volume-gain
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -150)
               (<= val 150))))))
  (volume-gain-max
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 0)
               (<= val 150))))))
  (volume-gain-min
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val -150)
               (<= val 0))))))
  (volume-max
   maybe-type/float
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/float? val)
               (>= val 100)
               (<= val 1000))))))
  (vulkan-async-compute maybe-type/boolean "")
  (vulkan-async-transfer maybe-type/boolean "")
  (vulkan-device maybe-type/string "")
  (vulkan-display-display maybe-type/integer "")
  (vulkan-display-mode maybe-type/integer "")
  (vulkan-display-plane maybe-type/integer "")
  (vulkan-queue-count
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1)
               (<= val 8))))))
  (vulkan-swap-mode
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(auto fifo fifo-relaxed mailbox immediate)))))))
  (watch-later-directory maybe-type/string "")
  (watch-later-options
   maybe-type/list-of-string
   "")
  (wayland-app-id maybe-type/string "")
  (wayland-configure-bounds
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto no yes)))))))
  (wayland-content-type
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto none photo video game)))))))
  (wayland-disable-vsync maybe-type/boolean "")
  (wayland-edge-pixels-pointer
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 2147483647))))))
  (wayland-edge-pixels-touch
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val 2147483647))))))
  (wayland-present maybe-type/boolean "")
  (wid maybe-type/integer64 "")
  (window-dragging maybe-type/boolean "")
  (window-maximized maybe-type/boolean "")
  (window-minimized maybe-type/boolean "")
  (window-scale
   maybe-type/double
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/double? val)
               (>= val 0.001)
               (<= val 100))))))
  (write-filename-in-watch-later-config
   maybe-type/boolean
   "")
  (x11-bypass-compositor
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no yes fs-only never)))))))
  (x11-name maybe-type/string "")
  (x11-netwm
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(auto no yes)))))))
  (x11-present
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no auto yes)))))))
  (x11-wid-title maybe-type/boolean "")
  (xv-adaptor
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val -1)
               (<= val +inf.0))))))
  (xv-buffers
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 1)
               (<= val 10))))))
  (xv-ck maybe-type/enumeration
         ""
         (sanitizer
          (lambda (val)
            (or (not (maybe-value-set? val))
                (and (maybe-type/enumeration? val)
                     (memq val '(use set cur)))))))
  (xv-ck-method
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(none bg man auto)))))))
  (xv-colorkey maybe-type/integer "")
  (xv-port
   maybe-type/integer
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/integer? val)
               (>= val 0)
               (<= val +inf.0))))))
  (ytdl maybe-type/boolean "")
  (ytdl-format maybe-type/string "")
  (ytdl-raw-options
   maybe-type/list-of-key-value
   "")
  (zimg-dither
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val '(no ordered random error-diffusion)))))))
  (zimg-fast maybe-type/boolean "")
  (zimg-scaler
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(point bilinear
                             bicubic
                             spline16
                             spline36
                             lanczos)))))))
  (zimg-scaler-chroma
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (memq val
                     '(point bilinear
                             bicubic
                             spline16
                             spline36
                             lanczos)))))))
  (zimg-scaler-chroma-param-a maybe-type/double "")
  (zimg-scaler-chroma-param-b maybe-type/double "")
  (zimg-scaler-param-a maybe-type/double "")
  (zimg-scaler-param-b maybe-type/double "")
  (zimg-threads
   maybe-type/enumeration
   ""
   (sanitizer
    (lambda (val)
      (or (not (maybe-value-set? val))
          (and (maybe-type/enumeration? val)
               (or (memq val '(auto))
                   (and (maybe-type/integer? val)
                        (>= val 1)
                        (<= val 64)))))))))

;;; Generated code - END.

(set-object-property!
 (module-ref (current-module) 'mpv-profile-configuration)
 'documentation
 (generate-documentation
  `((mpv-profile-configuration ,mpv-profile-configuration-fields))
  'mpv-profile-configuration))



\f
;;;
;;; Configuration base.
;;;
(define-maybe type/mpv-profile-configurations)
(define (serialize-type/mpv-profile-configurations _ profiles)
  #~(string-append
     #$@(map (match-lambda
               ((name . config)
                #~(string-append
                   #$(format #f "[~a]~%" name)
                   #$(serialize-mpv-profile-configuration _ config))))
             profiles)))
(define (type/mpv-profile-configurations? alist)
  (every (match-lambda
           (((? symbol?) . (? mpv-profile-configuration?)) #t)
           (_ #f))
         alist))

(define-maybe type/extra)
(define (serialize-type/extra _ value)
  #~(string-append #$value "\n"))
(define type/extra? string?)

(define (serialize-mpv-profile-configuration _ config)
  (serialize-configuration config mpv-profile-configuration-fields))

(define-configuration home-mpv-configuration
  (global
   mpv-profile-configuration
   "Globally valid settings, outputted before any profile.")
  (profiles
   maybe-type/mpv-profile-configurations
   "Alist mapping additional settings to specific profiles.  Key should be a
symbol, value an instance of @code{mpv-profile-configuration}.")
  (extra
   maybe-type/extra
   "Additional content to append to the end of the configuration file."))

(set-object-property!
 (module-ref (current-module) 'home-mpv-configuration)
 'documentation
 (generate-documentation
  `((home-mpv-configuration ,home-mpv-configuration-fields))
  'home-mpv-configuration))

[-- Attachment #1.3: Type: text/plain, Size: 120 bytes --]



-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#74748: Constructor created by define-configuration is slow (>25s) when many fields are defined
  2024-12-09 15:13 bug#74748: Constructor created by define-configuration is slow (>25s) when many fields are defined Tomas Volf
@ 2024-12-24 14:38 ` Ludovic Courtès
  2024-12-27 22:50   ` Tomas Volf
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2024-12-24 14:38 UTC (permalink / raw)
  To: Tomas Volf; +Cc: 74748

[-- Attachment #1: Type: text/plain, Size: 2841 bytes --]

Hi,

Tomas Volf <~@wolfsden.cz> skribis:

> I am writing a configuration for mpv and hit an issue of the generated
> constructor (`home-mpv-configuration') is extremely slow.  While the
> almost 800 fields is unusually high, initializing the instances of the
> record should *not* take almost 30 seconds.  The full file is attached
> to this email (as `mpv.scm').

AFAICS, time is spent in one of the compilation steps:

--8<---------------cut here---------------start------------->8---
scheme@(gnu home services mpv)> ,o interp #t
scheme@(gnu home services mpv)> ,t (lambda () (mpv-profile-configuration))
$13 = #<procedure 7f6ed3796700 at ice-9/eval.scm:330:13 ()>
;; 0.376347s real time, 0.375402s run time.  0.000000s spent in GC.
scheme@(gnu home services mpv)> ,o interp #f
scheme@(gnu home services mpv)> ,t (lambda () (mpv-profile-configuration))
$14 = #<procedure 7f6ec32088f8 at <unknown port>:40:3 ()>
;; 11.149828s real time, 12.052915s run time.  1.581736s spent in GC.
scheme@(gnu home services mpv)> ,t (->bool (macroexpand '(mpv-profile-configuration)))
$15 = #t
;; 0.373865s real time, 0.372698s run time.  0.000000s spent in GC.
--8<---------------cut here---------------end--------------->8---

If we look more closely, it’s the optimizing compiler that takes time;
the baseline compile (-O1) is doing okay:

--8<---------------cut here---------------start------------->8---
scheme@(gnu home services mpv)> ,use(system base compile)
scheme@(gnu home services mpv)> ,t (->bool (compile '(mpv-profile-configuration) #:to 'tree-il #:env (current-module)))
$20 = #t
;; 0.378741s real time, 0.377043s run time.  0.000000s spent in GC.
scheme@(gnu home services mpv)> ,t (->bool (compile '(mpv-profile-configuration) #:to 'bytecode #:env (current-module)))
$21 = #t
;; 11.946879s real time, 12.961704s run time.  1.777478s spent in GC.
scheme@(gnu home services mpv)> (define til (compile '(mpv-profile-configuration) #:to 'tree-il #:env (current-module)))
scheme@(gnu home services mpv)> ,t (->bool (compile til #:from 'tree-il #:to 'bytecode))
$22 = #t
;; 11.403420s real time, 12.317183s run time.  1.581972s spent in GC.
scheme@(gnu home services mpv)> ,t (->bool (compile til #:from 'tree-il #:to 'bytecode #:optimization-level 1))
$23 = #t
;; 0.225455s real time, 0.156137s run time.  0.000000s spent in GC.
--8<---------------cut here---------------end--------------->8---

Currently (guix build compile) applies these options to services:

        ((string-contains file "gnu/services/")
         ;; '-O2 -Ono-letrectify' compiles about ~20% faster than '-O2' for
         ;; large files like gnu/services/mail.scm.
         (override-option #:letrectify? #f
                          (optimizations-for-level 2)))

I think we should at least apply this patch:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 724 bytes --]

diff --git a/guix/build/compile.scm b/guix/build/compile.scm
index 5b27b55d02..f90016b9ae 100644
--- a/guix/build/compile.scm
+++ b/guix/build/compile.scm
@@ -127,7 +127,8 @@ (define (optimization-options file)
          ;; Use '-O1' to have partial evaluation and primitive inlining so we
          ;; can honor the "macro writer's bill of rights".
          (optimizations-for-level 1))
-        ((string-contains file "gnu/services/")
+        ((or (string-contains file "gnu/services/")
+             (string-contains file "gnu/home/services/"))
          ;; '-O2 -Ono-letrectify' compiles about ~20% faster than '-O2' for
          ;; large files like gnu/services/mail.scm.
          (override-option #:letrectify? #f

[-- Attachment #3: Type: text/plain, Size: 95 bytes --]


Would that be enough for the home-mpv configuration records you wrote?

Thanks,
Ludo’.

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* bug#74748: Constructor created by define-configuration is slow (>25s) when many fields are defined
  2024-12-24 14:38 ` Ludovic Courtès
@ 2024-12-27 22:50   ` Tomas Volf
  0 siblings, 0 replies; 3+ messages in thread
From: Tomas Volf @ 2024-12-27 22:50 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 74748

[-- Attachment #1: Type: text/plain, Size: 4366 bytes --]


Hello,

thank you for finding the time to look into this issue.  Replies below.

Ludovic Courtès <ludo@gnu.org> writes:

> Hi,
>
> Tomas Volf <~@wolfsden.cz> skribis:
>
>> I am writing a configuration for mpv and hit an issue of the generated
>> constructor (`home-mpv-configuration') is extremely slow.  While the
>> almost 800 fields is unusually high, initializing the instances of the
>> record should *not* take almost 30 seconds.  The full file is attached
>> to this email (as `mpv.scm').
>
> AFAICS, time is spent in one of the compilation steps:
>
> scheme@(gnu home services mpv)> ,o interp #t
> scheme@(gnu home services mpv)> ,t (lambda () (mpv-profile-configuration))
> $13 = #<procedure 7f6ed3796700 at ice-9/eval.scm:330:13 ()>
> ;; 0.376347s real time, 0.375402s run time.  0.000000s spent in GC.
> scheme@(gnu home services mpv)> ,o interp #f
> scheme@(gnu home services mpv)> ,t (lambda () (mpv-profile-configuration))
> $14 = #<procedure 7f6ec32088f8 at <unknown port>:40:3 ()>
> ;; 11.149828s real time, 12.052915s run time.  1.581736s spent in GC.
> scheme@(gnu home services mpv)> ,t (->bool (macroexpand '(mpv-profile-configuration)))
> $15 = #t
> ;; 0.373865s real time, 0.372698s run time.  0.000000s spent in GC.
>
>
> If we look more closely, it’s the optimizing compiler that takes time;
> the baseline compile (-O1) is doing okay:
>
> scheme@(gnu home services mpv)> ,use(system base compile)
> scheme@(gnu home services mpv)> ,t (->bool (compile '(mpv-profile-configuration) #:to 'tree-il #:env (current-module)))
> $20 = #t
> ;; 0.378741s real time, 0.377043s run time.  0.000000s spent in GC.
> scheme@(gnu home services mpv)> ,t (->bool (compile '(mpv-profile-configuration) #:to 'bytecode #:env (current-module)))
> $21 = #t
> ;; 11.946879s real time, 12.961704s run time.  1.777478s spent in GC.
> scheme@(gnu home services mpv)> (define til (compile '(mpv-profile-configuration) #:to 'tree-il #:env (current-module)))
> scheme@(gnu home services mpv)> ,t (->bool (compile til #:from 'tree-il #:to 'bytecode))
> $22 = #t
> ;; 11.403420s real time, 12.317183s run time.  1.581972s spent in GC.
> scheme@(gnu home services mpv)> ,t (->bool (compile til #:from 'tree-il #:to 'bytecode #:optimization-level 1))
> $23 = #t
> ;; 0.225455s real time, 0.156137s run time.  0.000000s spent in GC.
>
> Currently (guix build compile) applies these options to services:
>
>         ((string-contains file "gnu/services/")
>          ;; '-O2 -Ono-letrectify' compiles about ~20% faster than '-O2' for
>          ;; large files like gnu/services/mail.scm.
>          (override-option #:letrectify? #f
>                           (optimizations-for-level 2)))
>
> I think we should at least apply this patch:
>
> diff --git a/guix/build/compile.scm b/guix/build/compile.scm
> index 5b27b55d02..f90016b9ae 100644
> --- a/guix/build/compile.scm
> +++ b/guix/build/compile.scm
> @@ -127,7 +127,8 @@ (define (optimization-options file)
>           ;; Use '-O1' to have partial evaluation and primitive inlining so we
>           ;; can honor the "macro writer's bill of rights".
>           (optimizations-for-level 1))
> -        ((string-contains file "gnu/services/")
> +        ((or (string-contains file "gnu/services/")
> +             (string-contains file "gnu/home/services/"))
>           ;; '-O2 -Ono-letrectify' compiles about ~20% faster than '-O2' for
>           ;; large files like gnu/services/mail.scm.
>           (override-option #:letrectify? #f
>
>
> Would that be enough for the home-mpv configuration records you wrote?

I admit I did not test the patch attached, but my understanding is that
even if the speed up was sufficient, it would take effect only for
compilation via the make command.  Assuming that is correct, it would
not change much.  I am (luckily) former C++ developer, so I am used to
compilations taking ~forever.  So, yes, while the compilation of mpv.scm
(via `make') took roughly 40s on my machine, it was annoying, but not
worthy of a bug report.

The actual problem for me was the slowness in REPL.  Would that be
addressed by the patch above?  If not, do we have any way to do that?

)tomas

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-27 22:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-09 15:13 bug#74748: Constructor created by define-configuration is slow (>25s) when many fields are defined Tomas Volf
2024-12-24 14:38 ` Ludovic Courtès
2024-12-27 22:50   ` Tomas Volf

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.