luv

Workshop wiki

roundrect-benchmark.lisp

mcclim/roundrect-benchmark.lisp

system luv/mcclim/roundrect-benchmark · 6 definitions · on GitHub

Deterministic native-vs-decomposed rounded-rectangle performance proof.

in-package#:mcluv
define-application-frameroundrect-benchmark-frame
mode:initform:analytic:accessorroundrect-benchmark-mode
shape-count:initarg:shape-count:readerroundrect-benchmark-shape-count
:menu-barnil
:panes
canvas:application:display-function'display-roundrect-benchmark:scroll-barsnil
:layouts
defaultcanvas
defundisplay-roundrect-benchmark
framestream
loopwithcolumns=16withwidth=54withheight=34withradius=10forindexbelow
roundrect-benchmark-shape-countframe
forcolumn=
modindexcolumns
forrow=
floorindexcolumns
forleft=
+8
*column62
fortop=
+8
*row44
forright=
+leftwidth
forbottom=forink=
if
evenp
+rowcolumn
make-rgb-color0.180.480.92
make-rgb-color0.920.320.48
do
ecase
roundrect-benchmark-modeframe
:analytic
draw-analytic-rounded-rectangle*streamlefttoprightbottom:radiusradius:filledt:inkink
:decomposed
draw-rounded-rectangle*streamlefttoprightbottom:radiusradius:filledt:inkink
defunprepare-roundrect-benchmark-sample
framemirrormode
setf
roundrect-benchmark-modeframe
mode
let
*application-frame*frame
luv:with-cpu-trace-zone
:mcluv/redisplay
redisplay-frame-panesframe:force-pt
repaint-gpu-mirrormirror:present-pnil
defunroundrect-benchmark-stream-size
mirror
let
medium
sheet-medium
mirror-sheetmirror
list:commands
length
gpu-medium-commandsmedium
:solid-vertices
/
length
gpu-medium-verticesmedium
6
:analytic-vertices
/
length
gpu-medium-analytic-verticesmedium
12
defunrun-roundrect-tracy-benchmark
&key
shape-count256
repetitions30
ready-function

Trace equal native and McCLIM-decomposed roundrect frames on hidden Metal.

let
unwind-protect
let*
port
find-port:server-path'
:luv-gpu
manager
or
first
climi::frame-managersport
make-instance'luv-frame-manager:portport
setfframe
make-application-frame'roundrect-benchmark-frame:frame-managermanager:enablenil:shape-countshape-count:width1010:height720
let*
sheet
frame-top-level-sheetframe
mirror
sheet-direct-mirrorsheet
unless
typepmirror'luv-gpu-mirror
error"Roundrect benchmark did not realize a GPU mirror."
let
setf
sheet-enabled-psheet
t

Initialize both pipelines and grow retained buffers before the capture. These frames are intentionally not measured.

let
let
decomposed-size
whenready-function
funcallready-function
looprepeat300untildo
sleep0.1
finally
unless
error"Tracy did not connect within 30 seconds."
luv:tracy-message"McCLIM roundrect A/B begins"
looprepeatrepetitionsdo
luv:with-cpu-trace-zone
:mcluv/analytic-sample:tracy-valueshape-count
luv:with-cpu-trace-zone
:mcluv/decomposed-sample:tracy-valueshape-count
luv:tracy-message"McCLIM roundrect A/B complete"
formatt"Analytic stream: ~S~%Decomposed stream: ~S~%"analytic-sizedecomposed-size
force-output
list:analyticanalytic-size:decomposeddecomposed-size
whenframe
destroy-frameframe