edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiB3050ac9Tahinli3 months ago553 commits
| 1 | #!/usr/bin/env bash |
| 2 | # The decode/encode baseline: runs `examples/bench` over a list of real files |
| 3 | # and writes one TSV of medians. Every later codec change is compared against |
| 4 | # the file this produces, so it is meant to be run twice -- before and after -- |
| 5 | # on an otherwise idle machine. |
| 6 | # |
| 7 | # scripts/bench.sh <out_dir> [file ...] |
| 8 | # |
| 9 | # With no files it reads them from $BENCH_LIST (one path per line, `#` comments |
| 10 | # allowed), and failing that from assets/test_av.mp4. The list lives *outside* |
| 11 | # this repo on purpose: what is measured here is a personal media library and |
| 12 | # its file names are not this project's to record. |
| 13 | # |
| 14 | # Output in <out_dir>: baseline.tsv (the data) and bench.log (every run's |
| 15 | # stderr, decoder panics included). |
| 16 | # |
| 17 | # Methodology, so a rerun means the same thing: |
| 18 | # * cold = the file's pages dropped with posix_fadvise(DONTNEED) immediately |
| 19 | # before the measurement -- no root, nothing else on the machine evicted, |
| 20 | # and advisory, so it is the optimistic end of cold. |
| 21 | # * warm = the same call repeated straight after, cache as the cold run left it. |
| 22 | # * medians of 5 for open and seek, 50 seeded random seeks for a seek storm, |
| 23 | # $BENCH_PLAYLOOP_SECS (30) of playing with a jump every 5 s for a play |
| 24 | # loop -- both drawn from $BENCH_SEED (1), so a rerun seeks the same |
| 25 | # places -- 20 steps for a scrub, and for export as |
| 26 | # many reps as $BENCH_EXPORT_CAP seconds leave room for (at least one, |
| 27 | # which is then marked CAPPED if it did not finish). |
| 28 | # * every metric runs as its own process: a decoder that panics costs one |
| 29 | # row, not the run. |
| 30 | # * the media files are opened read only; only <out_dir> is written to. |
| 31 | |
| 32 | |
| 33 | |
| 34 | OUT_DIR= |
| 35 | if [; then |
| 36 | |
| 37 | |
| 38 | fi |
| 39 | |
| 40 | |
| 41 | TSV="/baseline.tsv" |
| 42 | LOG="/bench.log" |
| 43 | |
| 44 | # Absolute, because $CARGO_TARGET_DIR may already be one and the plugin path |
| 45 | # below must not become "$PWD/$HOME/...". |
| 46 | TARGET= |
| 47 | # The plugins are their own build: `--example` selects example targets in every |
| 48 | # package it is given, and a cdylib is not one, so `-p engine-hw --example |
| 49 | # bench` built no plugin at all and every run measured software while the line |
| 50 | # below said otherwise (measured 2026-08-13: the film's hardware export read |
| 51 | # 11.55 fps as silent software, 94.58 fps once the plugin was there). |
| 52 | # engine-audio is here for the same reason -- the play loop's underruns come |
| 53 | # from the device, and with no plugin there is no device. |
| 54 | || |
| 55 | || |
| 56 | BENCH="/release/examples/bench" |
| 57 | [ || { |
| 58 | |
| 59 | |
| 60 | } |
| 61 | # The plugin is looked for beside the running executable, and an example binary |
| 62 | # lives one directory below the plugin: without this, hardware decode and |
| 63 | # hardware encode silently fall back to software and the baseline is a lie. |
| 64 | # Measured on the control file: seek to 600 s is 23 ms on the plugin and |
| 65 | # 1359 ms without it, and every export seat reads "SW". |
| 66 | |
| 67 | |
| 68 | files=("") |
| 69 | if [ && [; then |
| 70 | while ; do |
| 71 | [ && continue |
| 72 | case "" in \#*) continue ;; esac |
| 73 | files+=("") |
| 74 | done |
| 75 | fi |
| 76 | [ && files=(assets/test_av.mp4) |
| 77 | |
| 78 | { |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | } | |
| 84 | |
| 85 | |
| 86 | # One metric, one process, one row -- even when the process dies. |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | export_cap= |
| 104 | export_limit= |
| 105 | |
| 106 | for; do |
| 107 | if [; then |
| 108 | |
| 109 | continue |
| 110 | fi |
| 111 | |
| 112 | for; do |
| 113 | |
| 114 | done |
| 115 | |
| 116 | # The two random metrics: same seed both sides of a change, or the "before" |
| 117 | # and the "after" are different seeks and the comparison means nothing. |
| 118 | |
| 119 | |
| 120 | for; do |
| 121 | |
| 122 | done |
| 123 | done |
| 124 | |
| 125 | | |
| 126 |